How to get an outputBit carried to a procedure or funtion?

General discussion on mikroPascal PRO for AVR.
Post Reply
Author
Message
mikroSeven
Posts: 161
Joined: 14 Mar 2016 10:24
Contact:

How to get an outputBit carried to a procedure or funtion?

#1 Post by mikroSeven » 01 May 2024 11:22

Hi,

example code, only the basics due of my question:

Code: Select all

var
output1: sbit at portL1_bit; 
output2: sbit at portL2_bit; 
// etc...



procedure doOutput( outputNR: ????? ); 
begin
   outputNR:= 1;
   //more code
   outputNR:= 0;  
   
  {
   output1:= 1 // this works of course 
   
  } 	  
end; 



// calling the procedure:
doOutput( output1 );



What do I need to place on the ?????? ?
It's a kinda pointer-thing?

Kind regards! Marcel
To DIY or not to DIY

mikroSeven
Posts: 161
Joined: 14 Mar 2016 10:24
Contact:

Re: How to get an outputBit carried to a procedure or funtion?

#2 Post by mikroSeven » 01 May 2024 19:02

I've come to the conclusion that I need another aproach!
Kind regards.
To DIY or not to DIY

mikroSeven
Posts: 161
Joined: 14 Mar 2016 10:24
Contact:

Re: How to get an outputBit carried to a procedure or funtion?

#3 Post by mikroSeven » 01 May 2024 19:49

Some research concluded, not to pass sbit/bit via funtions and procedures.

Gave it the following aproach. succesfuly:
( portL has all the CS's pins )

Code: Select all

const
   pinCS1 = 2;
   pinCS2 = 3;
   //etc


procedure writeDigitTM1638( CSn: byte; myPos: byte; myChar: byte );
begin
   portL.CSn:= 1
  // much more code...
  
end; 


// calling the procedure
writeDigitTM1638( CSn: byte; myPos: byte; myChar: byte );

Works fine!

I needed this in case of multiple, sellectingTM1638 chips.
( for a single chip I had the code allready funcioning )

Kind regards.
To DIY or not to DIY

mikroSeven
Posts: 161
Joined: 14 Mar 2016 10:24
Contact:

Re: How to get an outputBit carried to a procedure or funtion?

#4 Post by mikroSeven » 02 May 2024 08:47

Things work fine, for testing just some counting...

https://www.youtube.com/watch?v=OBno3eFYW5o
To DIY or not to DIY

Post Reply

Return to “mikroPascal PRO for AVR General”