GregK
- 18th March 2005, 00:23
Hi
When powering up the Pic the outputs are high, when I set them as outputs and low. When I ground an input pin, the loop works fine. Please tell me what I am doing wrong.
Set registers for all digital I/O:
ANSEL = 0
CMCONO =7
ADCON0 = 7
VRON = 0.
TRISIO = %00111000 'Set all pins as outputs except 3.4.5
'Inputs:
ExtendIn var gpio.4
RetractIn var gpio.5
'Outputs:
ExtendOut var gpio.0
Low ExtendOut
RetractOut var gpio.1
Low RetractOut
Loop:
If ExtendIn = 0 then
High ExtendOut
Pause 2000
Low ExtendOut
Endif
If RetractIn = 0 then
High RetractOut
Pause 2000
Low RetractOut
Endif
Goto Loop
My output's are just LED's with 1K ohm series resistors. The LED's are connected so a high pin lites the Led. I have read the data sheets and I'm still not sure about the register settings. I am using Pic Basic Pro 2.45.
Any help or suggestions would be greatly appreciated.
Thanks
Greg
When powering up the Pic the outputs are high, when I set them as outputs and low. When I ground an input pin, the loop works fine. Please tell me what I am doing wrong.
Set registers for all digital I/O:
ANSEL = 0
CMCONO =7
ADCON0 = 7
VRON = 0.
TRISIO = %00111000 'Set all pins as outputs except 3.4.5
'Inputs:
ExtendIn var gpio.4
RetractIn var gpio.5
'Outputs:
ExtendOut var gpio.0
Low ExtendOut
RetractOut var gpio.1
Low RetractOut
Loop:
If ExtendIn = 0 then
High ExtendOut
Pause 2000
Low ExtendOut
Endif
If RetractIn = 0 then
High RetractOut
Pause 2000
Low RetractOut
Endif
Goto Loop
My output's are just LED's with 1K ohm series resistors. The LED's are connected so a high pin lites the Led. I have read the data sheets and I'm still not sure about the register settings. I am using Pic Basic Pro 2.45.
Any help or suggestions would be greatly appreciated.
Thanks
Greg