Write a program to run a winch (like H bridge I guess). Post below. I get a compile error on line 10-14 (the 5 Direction lines). No details on the error, just syntax. First for me? Any ideas?
~~~~
#chip 12F675, 4
#config osc = int
#define LED GPIO.5 'LED working and on LED
#define PWR GPIO.0 'PWR ON RELAY
#define DIR GPIO.1 'Relay for DIRECTION
#define REV GPIO.2 'RF Button A REV
#define FWD GPIO.4 'RF Button B FWD
Dir LED Out
Dir PWR Out
Dir DIR Out
Dir REV In
Dir FWD In
top:
set LED OFF
wait 250 msec
IF REV = 1 and FWD = 1 then
Set PWR OFF
END IF
If REV = 0 then
Set PWR ON
Set DIR OFF
end if
If FWD = 0 then
Set PWR ON
Set DIR ON
end if
set LED ON
wait 250 msec
goto top
end
Last edit: Anobium 2014-12-24
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You used a reserved word as one of your port address. I have simply change DIR to RELAYDIR to resolve.
~~~~
#chip 12F675, 4
#config osc = int
#define LED GPIO.5 'LED working and on LED
#define PWR GPIO.0 'PWR ON RELAY
#define RELAYDIR GPIO.1 'Relay for DIRECTION
#define REV GPIO.2 'RF Button A REV
#define FWD GPIO.4 'RF Button B FWD
Dir LED Out
Dir PWR Out
Dir RELAYDIR Out
Dir REV In
Dir FWD In
top:
set LED OFF
wait 250 msec
IF REV = 1 and FWD = 1 then
Set PWR OFF
END IF
If REV = 0 then
Set PWR ON
Set RELAYDIR OFF
end if
If FWD = 0 then
Set PWR ON
Set RELAYDIR ON
end if
set LED ON
wait 250 msec
goto top
end
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Opps. Being using the compiler for years, rare problems if any. DUH! I guess I need longer define names from now on. It was driving me nuts. Too funny.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Write a program to run a winch (like H bridge I guess). Post below. I get a compile error on line 10-14 (the 5 Direction lines). No details on the error, just syntax. First for me? Any ideas?
~~~~
#chip 12F675, 4
#config osc = int
#define LED GPIO.5 'LED working and on LED
#define PWR GPIO.0 'PWR ON RELAY
#define DIR GPIO.1 'Relay for DIRECTION
#define REV GPIO.2 'RF Button A REV
#define FWD GPIO.4 'RF Button B FWD
Dir LED Out
Dir PWR Out
Dir DIR Out
Dir REV In
Dir FWD In
top:
goto top
end
Last edit: Anobium 2014-12-24
Easy to correct.
You used a reserved word as one of your port address. I have simply change DIR to RELAYDIR to resolve.
~~~~
#chip 12F675, 4
#config osc = int
#define LED GPIO.5 'LED working and on LED
#define PWR GPIO.0 'PWR ON RELAY
#define RELAYDIR GPIO.1 'Relay for DIRECTION
#define REV GPIO.2 'RF Button A REV
#define FWD GPIO.4 'RF Button B FWD
Dir LED Out
Dir PWR Out
Dir RELAYDIR Out
Dir REV In
Dir FWD In
top:
goto top
end
Opps. Being using the compiler for years, rare problems if any. DUH! I guess I need longer define names from now on. It was driving me nuts. Too funny.
:-)