I had try the program that you gave me. It is work.Thank.
Some problem has finding out....
***********'Produce squarewave on PortB.0 period~4.32s, 50% dutycycle.
Loop var Word
Main:
High PortB.0
For Loop = 0 to 2160 'Loop here for ~2.16s, tweak to match.
PauseUs 1000
Next
Low PortB.0
For Loop = 0 to 2160 'Loop here for ~2.16s, tweak to match.
PauseUs 1000
Next
Goto Main**********
The above is the code that you posted to me. Thanks to you again.
I had modify it like the code below:-
********'Produce squarewave on PortB.0 period~4.32s, 50% dutycycle.
Loop var Word
SolarVoltage var word
ADCON1 = %10001110
Main:
High PortB.0
For Loop = 0 to 2160 'Loop here for ~2.16s, tweak to match.
PauseUs 1000
ADCIN 0,SolarVoltage
LCDOUT $FE,$1,#SolarVoltage
If SolarVoltage = 300 then
high motor ' motor stop
ELSE
low motor ' motor run
ENDIF
If update = 1 then
LCDOUT $FE,$C0,DEC2 Hour,":",DEC2 Minute,":",DEC2 Second
ENDIF
Next
Low PortB.0
For Loop = 0 to 2160 'Loop here for ~2.16s, tweak to match.
PauseUs 1000
ADCIN 0,SolarVoltage
LCDOUT $FE,$1,#SolarVoltage
If SolarVoltage = 300 then
high motor ' motor stop
ELSE
low motor ' motor run
ENDIF
If update = 1 then
LCDOUT $FE,$C0,DEC2 Hour,":",DEC2 Minute,":",DEC2 Second
ENDIF
Next
Goto Main
ON INTERRUPT
'
'Time calculation
'
'
Update = 1 'update diaplay after 1 second*************
The display: ****************
0 ' when increase the A/D input, the value
00:00:00 'increase to 0 then 1 then 2 then
**************** 'maximum is 3
Bookmarks