Lionheart
- 3rd December 2008, 10:28
I have only connected de main supply at the the PIC12CE674, because in the configuration word you can chooce to turn on the 4MHz clock inside and the reset internally connected to VDD.
So i think there is nothing wrong with the hardware.
For the program:
'Register Initializations'
TRISIO.0 = 1
TRISIO.1 = 0
TRISIO.2 = 0
TRISIO.3 = 1
TRISIO.4 = 1
TRISIO.5 = 1
'Variabelen
Input_1 VAR GPIO.4
Input_2 VAR GPIO.5
Output_1 VAR GPIO.1
Output_2 VAR GPIO.2
Memory_1 var bit
Memory_2 VAR bit
Max_Pulsen VAR WORD
Pulsen_1 VAR WORD
Pulsen_2 VAR WORD
Max_Pulsen = 100
Main: if (Input_1=1 & Memory_1=0) then
Pulsen_1 = Max_pulsen
Memory_1 = 1
ENDif
if (Input_2=1 & Memory_2=0) then
Pulsen_2 = Max_pulsen
Memory_2 = 1
ENDif
if (Pulsen_1 > 0) then
Toggle Output_1
else
Memory_1 = 0
output_1 = 0
endif
if (Pulsen_2 > 0) then
Toggle Output_2
else
Memory_2 = 0
output_2 = 0
endif
pause 1000 'pause van 1sec
goto main
end
The thing i i'm not sure about are the ID locations. I left them at FFFF
Thanxs at advance
So i think there is nothing wrong with the hardware.
For the program:
'Register Initializations'
TRISIO.0 = 1
TRISIO.1 = 0
TRISIO.2 = 0
TRISIO.3 = 1
TRISIO.4 = 1
TRISIO.5 = 1
'Variabelen
Input_1 VAR GPIO.4
Input_2 VAR GPIO.5
Output_1 VAR GPIO.1
Output_2 VAR GPIO.2
Memory_1 var bit
Memory_2 VAR bit
Max_Pulsen VAR WORD
Pulsen_1 VAR WORD
Pulsen_2 VAR WORD
Max_Pulsen = 100
Main: if (Input_1=1 & Memory_1=0) then
Pulsen_1 = Max_pulsen
Memory_1 = 1
ENDif
if (Input_2=1 & Memory_2=0) then
Pulsen_2 = Max_pulsen
Memory_2 = 1
ENDif
if (Pulsen_1 > 0) then
Toggle Output_1
else
Memory_1 = 0
output_1 = 0
endif
if (Pulsen_2 > 0) then
Toggle Output_2
else
Memory_2 = 0
output_2 = 0
endif
pause 1000 'pause van 1sec
goto main
end
The thing i i'm not sure about are the ID locations. I left them at FFFF
Thanxs at advance