4Anobium. Morning, I now have an updated GCB.exe latest build, but for the life of me I cannot remember what I have to do to have IDE talk to my PIC2 or PIC3 programmer. Still that is a problem for some other time.
After installing the new GCB.exe last night I had another read through the Microchip 10F202 datasheet, not that I’m any wiser for it but something seemed to point me to the #config MCLRE= which is normally in the OFF mode.
Tried that out this morning, but that is not the answer. As it as it resets the entire device on an input which is not really what I’m looking for.
Do you still want to see my coding effort ? (no laughing please!)
Regards
Keith
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This code is a simple latching switch for a battery powered module for a young lad with learning difficulties. It works quite well but I need to make it go to sleep when it switched off.
;Chip Settings
#chip 10F202,4
#config MCLRE=OFF, CP=OFF, WDT=OFF, OSC=INTRC
'Defines (Constants)
#define Mag_Input GPIO.3
#define activity_led GPIO.2
#define Forward_Output GPIO.0
#define Reverse_Output GPIO.1
'
' Pinout Data 10F202
' --------
' GPO -|1 6|- GP3
' VSS -|2 5|- VDD
' GP1 -|3 4|- GP2
' --------
dir GPIO b'01000' 'Ports 0, 1, 2, & 4 Output Port 3 Input
call Initialise
Switch_Count = 0
flag_swap = 0
flag = 0
Mag_Input = 0
Main:
If Mag_Input = 1 Then
Wait 500 ms
flag = 0
call Flag_on
End If
If Mag_Input = 0 Then
Wait 500 ms
flag = 1
Call Flag_on
End If
goto main
sub Flag_on
if flag = 1 then
flag_swap =1
end if
if flag = 0 and flag_swap = 1 then
flag_swap = 0
Sw_next = 1
call Switch
end if
end sub
Sub Switch
if Sw_next = 1 and Switch_Count = 0 then
set Forward_Output on:Set activity_led On
Sw_next = 0
Switch_Count = 1
goto Main
end if
if Sw_next = 1 and Switch_Count = 1 then
set Forward_Output off:Set activity_led Off
Switch_Count = 0
' asm SLEEP
goto Main
end if
end sub
'Initialise
Sub Initialise
count = 0
For init = 0 To 2
Set activity_led on
Wait 200 ms
Set activity_led Off
Wait 200 ms
Next
set Forward_Output off
End Sub
Sorry but I don't seem to be able to stop the first few lines of code displaying in huge characters. I did work it a while back but for the life of me I cannot remeber !
Last edit: Anobium 2015-11-17
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
How did you sort out my posting... ? as I said, I couldn't remember what it was..
I have sorted my IDE to write to my PICkit2 by deleting the appropriate rem statement in the flashpic batch file, but I am struggling to get my PICkit3 to work. No big cheese though – I can live with it like that.
Regards
Keith, (AKA Mick)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
@Kieth. Please send me me a personal message with your contact email. I will let you have the latest v0.95 build.
4Anobium. Morning, I now have an updated GCB.exe latest build, but for the life of me I cannot remember what I have to do to have IDE talk to my PIC2 or PIC3 programmer. Still that is a problem for some other time.
After installing the new GCB.exe last night I had another read through the Microchip 10F202 datasheet, not that I’m any wiser for it but something seemed to point me to the #config MCLRE= which is normally in the OFF mode.
Tried that out this morning, but that is not the answer. As it as it resets the entire device on an input which is not really what I’m looking for.
Do you still want to see my coding effort ? (no laughing please!)
Regards
Keith
@Keith..... See https://www.google.co.uk/url?sa=t&source=web&cd=1&ved=0CBsQtwIwAGoVChMI35aI7raXyQIVBTYaCh0gIgir&url=http%3A%2F%2Fm.youtube.com%2Fwatch%3Fv%3DsihTRkl6CDE&usg=AFQjCNFFdccnuoRg5zgJXZYJoWG95jGV-Q for one way to use a PicKit.
I will post a video explaining how to edit the IDE setup files soon.
Re your code. Promise not to laugh.
Last edit: Anobium 2015-11-17
(psst. I'm not Mick!)
This code is a simple latching switch for a battery powered module for a young lad with learning difficulties. It works quite well but I need to make it go to sleep when it switched off.
Sorry but I don't seem to be able to stop the first few lines of code displaying in huge characters. I did work it a while back but for the life of me I cannot remeber !
Last edit: Anobium 2015-11-17
Which port do have the switch to raise from sleep? It is gpio.3 ? As all the other ports are inputs.
PS... I edited your posting.... have a looksy.
Yes, GPIO 3 is the Switch.
How did you sort out my posting... ? as I said, I couldn't remember what it was..
I have sorted my IDE to write to my PICkit2 by deleting the appropriate rem statement in the flashpic batch file, but I am struggling to get my PICkit3 to work. No big cheese though – I can live with it like that.
Regards
Keith, (AKA Mick)
You may need to read the ports prior to sleep. I have read this before.
And, to fix the posting. If you edit it again, and, review the tilders - this fixes it.
The instruction 'readallports compiles okay, but the chip still falls int a coma to where only a power up restart brings it back to life
Unless I doing something stupid (again) or haven't put it into the right place:
if Sw_next = 1 and Switch_Count = 0 then
set Forward_Output on:Set activity_led On
Sw_next = 0
end if
if Sw_next = 1 and Switch_Count = 1 then
set Forward_Output off:Set activity_led Off
Switch_Count = 0
end if
Regards
Keith