High sends 5v, but a variable sends 1v
I am using SX/B with an SX28.· I am trying to send 5v from any port using the following code:
rc.3=pinc(1)
Output rc.3
pinc(1)=1
I can only get about 1 volt signal however if I change this to the following code I can get 5 volts.
High rc.3
Why does this happen?
I want to be able to define pins with variables so that I can use a for next loop to control them.
rc.3=pinc(1)
Output rc.3
pinc(1)=1
I can only get about 1 volt signal however if I change this to the following code I can get 5 volts.
High rc.3
Why does this happen?
I want to be able to define pins with variables so that I can use a for next loop to control them.
Comments
pinc var byte (8)·
'The # in parentheses is the total number of bytes possible.· With this example you have available pinc (0), pinc (1),... pinc (7)
Update:·You'll find·plenty on this in SX/B Help --
SX/B Help
· SX/B Definitions
··· Variables
Post Edited (PJ Allen) : 4/14/2007 7:28:44 PM GMT
You CAN use a bit mask to control them.
For example to set each bit in RC high you'd do something like:
FOR temp = 0 TO 7
temp2 = 1 << temp
RC = RC OR temp2
NEXT
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"Educate your children to self-control, to the habit of holding passion and prejudice and evil tendencies subject to an upright and reasoning will, and you have done much to abolish misery from their future and crimes from society"
Benjamin Franklin
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.hittconsulting.com
·
Yes, I have declared the array properly.· Thanks.
Bean:
Thanks,·I figured it was something like that.· I think I can get the bit shift to work, though it's not the way I hoping.· It sure would be convenient to assign variable names to the pins...
Mark
You can assign a variable name to a pin, but a command compiles to instructions that affect a certain pin. So the same command cannot affect a different pin.
LED1 PIN RC.0 OUTPUT
LED2 PIN RC.1 OUTPUT
HIGH LED1
HIGH LED2
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"Educate your children to self-control, to the habit of holding passion and prejudice and evil tendencies subject to an upright and reasoning will, and you have done much to abolish misery from their future and crimes from society"
Benjamin Franklin
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.hittconsulting.com
·