Reset From PC

pilko

Senior Member
Hi everyone,
Is there a way to reset a 28X1 from a PC?
I am using SERTXD on a continuous basis and would like to be able to reset all the info to zero from my PC. I am currently reprogramming to cause the reset, but it takes about 30 seconds and would like to do it much faster.

Regards

pilko
 

Dippy

Moderator
How about if you do some code so that a particular command string from your PC makes your PICAXE code do a 'Reset' - see Manual 2.
Or similar but your PICAXE code jumps to an Initialise subroutine/block.
 

pilko

Senior Member
Dippy, I am currently using all 28 bytes.

tjetson, I am operating the PC that is connected to the Picaxe from a remote PC and don't have access to the hardware.
 

tjetson

Senior Member
Dippy, I am currently using all 28 bytes.

tjetson, I am operating the PC that is connected to the Picaxe from a remote PC and don't have access to the hardware.
I meant using the software on the computer to send a high along the serial in line for the Picaxe.
 

lbenson

Senior Member
Are you using serrxd to read bytes from the PC? If so, you could send a value which the 28x1 uses to reset the values you want. Of course, serrxd is blocking, so if you are not continuously sending from the PC, your program would stall (you could send dummy values).

With some serial cables you might be able to use one of the control lines (CTS, RTS, etc.) to control external hardware to pull the reset pin low--or to take any other pin low; the picaxe could monitor the pin and reset the values when it went low. Or you could just have a pushbutton and reset values when it is active.

If this is just to be done during the debugging process, it may be easier just to continue with reprogramming.
 

Dippy

Moderator
"I am operating the PC that is connected to the Picaxe from a remote PC and don't have access to the hardware."
So, you don't have access to hardware or PICAXE code?
Something like: Pilko+PC >>>> PC >>>> PICAXE. ?

Maybe in PC code you could fool PICAXE into thinking the Editor was requesting a download and then just let the PICAXE timeout and restart?

Are there any more details you would like to tell us about to help with suggestions?
 

hippy

Ex-Staff (retired)
I think we need additional information on what the setup is, how it's controlled, and what hardware the PC connected to the PICAXE has which could be used to achieve a reset.

Almost any signal which can be generated by a PC to the wider world can be used to reset the PICAXE and be controlled by an application with a software GUI 'reset button'. You could use a line printer output port, a serial port, or a USB-to-serial cable; a second AXE027 download cable should do the job nicely.

Added : It would be possible to use the single download cable to generate a hard-reset for a PICAXE and be able to control that from software and have the Programming Editor running. I have a circuit for that somewhere. I'll see if I can find it.
 
Last edited:

SD2100

New Member
He says that he would like to reset all info to zero and has been reprogramming to acheive this, so is some of this info in eeprom which will survive a reset, if so then a bit of extra code needed at reset to clear the eeprom.
 

pilko

Senior Member
Thanks everyone for your responses.---couldn.t respond, an emergency came up.
Every day it becomes more apparent how little I know about the PICAXE and that I know nothing about serial communications.
I have a 28X1 programmed to control my Heatpump in my basement A laptop is permanently connected to the chip via an AXE27
USB cable and I sertext to the laptop 24/7 using the Serial Terminal
I have another computer upstairs that controls the basement laptop using an application called TEAMVIEWER this enables me
to view whats happening on the heatpump via the programming editor and the serial terminal on the laptop.
Once in a while I need to reset the 28X1. I presently do this by
re-programming (with the same program) the chip, either from upstairs via the TeamViewer or directly from the basement laptop, This takes about 30 seconds and I would like to do it much faster

I am not using EEPROM.

Attached are the code (excuse the inelegance) and a view of the serial terminal.

Regards
pilko

Code:
'HP26 Temp Controlled Fan

                           'INPUTS                   'OUTPUTS                   'Variables
                     symbol HP     = pin0       : symbol Rplen  =   1       : symbol FeedTemp   = b0
                     symbol ORANGE = pin1       : symbol Roil   =   2       : symbol RetTemp    = b1
                     symbol WH2    = pin2       : symbol ConFroze = 3       : symbol DiffTemp   = b2
                     symbol DFT    = pin3       : symbol RSU    =   4       : symbol OutTemp    = b3
                     symbol STAT    = pin7         symbol RFL    =   5       : symbol FrostLevel = b4
                                                  symbol Rfan   =   6       : symbol TimerSA    = b5
                                                  symbol FSFW   =   0       : symbol TimerSB    = b6
                                                  symbol Yellow =   7         symbol Timerfrost = b7
                                                                              symbol ManFan     = b8
                                                                              symbol DFStart    = b9
                                                                              symbol DFStop     = b9
                                                                              symbol FanRunning = b10
                                                                              symbol FanDisplay = b15
                                                                              symbol SAaux      = b16
                                                                              symbol SBaux      = b17
                                                                              symbol DFaux      = b18
                                                                              
                                                                              
                                                                            
main:                                                                                                                                                                
setint %00001110,%00001110                                            

readadc  0 ,b4  'Frost level                                                    
readadc  1 ,b8  'Man Fan
readadc  2 ,b9  'DF Start and DF end
readadc  3 ,b10 'Fan Running

ff:
readtemp 4 ,b0  'Feed Temp
readtemp 4 ,b11
if b0<>b11 then ff

gg:
readtemp 5 ,b1  'Return Temp
readtemp 5 ,b12
if b1<>b12 then gg
readtemp 6 ,b3  'Outdoor Temp

sertxd("    STAT","    HP","    DFT","     FEED","     RET","     DIFF","     FROST",cr,lf)

sertxd("    ",#b22,"          ",#b13,"        ",#b14,"           ",#b0,"          ",#b1,"         ",#b2,"          ",#b4,cr,lf)

sertxd(" ",cr,lf)

sertxd("    FAN","     TA","     TB","    TDF","    SAaux","    SBaux","    DFaux",cr,lf)

sertxd("        ",#b15,"         ",#b5,"      ",#b6,"        ",#b7,"       ",#b16,"            ",#b17,"          ",#b18,cr,lf)

sertxd(" ",cr,lf)

sertxd("    Fan Fail","     FSFW","     Con Froze","    KW Timer","   KWA","     KWB","      KWC",cr,lf)

sertxd("        ",#b20,"             ",#b21,"                ",#b19,"                  ",#b23,"            ",#b25,"          ",#b26,"          ",#b27,cr,lf)          

sertxd(" ",cr,lf)

wait 13
let DiffTemp=FeedTemp-RetTemp	


if b19>1 then high Rfan let FanDisplay=1 endif   '----Contactor Froze Keep Fan Running
if HP=1 and FeedTemp>25 or  ManFan>10 or  ORANGE=1 then high Rfan let FanDisplay=1 endif '----FAN
if Stat=0 and FeedTemp>30 or  ManFan>10 then high Rfan let FanDisplay=1 endif
if FeedTemp<26 and ManFan<10 and HP=0 and b19<2 then low  Rfan let FanDisplay=0 endif 
	
if DiffTemp<18 and HP=1 and ORANGE=0 and WH2=0 then let TimerSA=TimerSA+1MAX 92 endif 
if DiffTemp<18 and HP=0 or  ORANGE=1 or  WH2=1 then let TimerSA=0 endif
if DiffTemp>18 and HP=1 and ORANGE=0 and WH2=0 then let TimerSA=0 endif
if TimerSA>90 then let SAaux=1 else let SAaux=0 endif  '------------------------------------TS-A

if HP=1 and ORANGE=0 and WH2=0 then let TimerSB=TimerSB+1MAX 102 else let TimerSB=0 endif 
if TimerSB>100 then let SBaux=1 else let SBaux=0 endif '-------------------------------------TS-B

if HP=1 and DFStart>100 and DFT=1 and DFStop<10 and TimerFrost<2 then let DFaux=1 endif '-----Tfrost               
if HP=1 and FrostLevel>111 and ORANGE = 0 and DFT = 1 and DFStop<10 and TimerFrost<2  then let DFaux=1 endif 
if HP=1 and DFT=1 and FrostLevel>100 or DFStart>100 then let TimerFrost=TimerFrost+1MAX 32 endif  
if TimerFrost>30 or DFStart<10 and FrostLevel<50  then let DFaux=0 endif
if DFT=0 or FrostLevel<50 and DFStart<101 then let TimerFrost=0 endif
if DFStop>10 and DFStop<101 then let TimerFrost=0 endif


if SAaux=1 or DFaux=1 then high Rplen endif          'Plenum Heater
if SAaux=0 and DFaux=0 then low Rplen endif

if SBaux=1 then high Roil else low Roil endif           'Oil

if FrostLevel<5 or FrostLevel>200 then let b21=b21+1MAX 11 endif '------Frost sensor failure warning
if b21>5 then high FSFW,RFL endif
if FrostLevel>4 and FrostLevel<201 then low FSFW let b21=0 endif  '--------Put Defrost in Time Mode

if TimerFrost>25 and b10<10 and ORANGE=0 and WH2=0 then high RSU,RFL endif  '---Speed-Up 4 and RFL 5
if FrostLevel>9 and FrostLevel<151 and DFT=0 or DFStop>10 then low RFL endif


if STAT=1 then let b22=1 else let b22=0 endif          'Sertext "STAT 1" else Sertext "STAT 0"
if HP=1 then let b13=1 else let b13=0 endif            'Sertext "HP 1" else Sertext "HP 0"
if DFT=1 then let b14=1 else let b14=0 endif           'Sertext "DT 1" else Sertext "DT 0"

if HP=1 and STAT =0 then let b19 = b19 + 1MAX 3 endif   'Heat Pump contactor froze. Alarm and keep fan running
if HP=0 then let b19=0 endif
if b19>1 then high ConFroze else low ConFroze endif

if b0>25 and b0<45 and b10<100 and HP=1 then let b20=b20+1MAX 10 endif           'Fan Failure
if b0<26 and b10<100 and STAT=1 and ORANGE=1 then let b20=b20+1MAX 10 endif
if b0>50 and b10<100 then let b20=b20+1MAX 10 endif
if b0<26 and b10<100 and STAT=1 then let b20=0 endif
if b10>99 then let b20=0 endif
if b20>2 then high Yellow else low Yellow endif   'Stop Haet Pump or Oil Burner

b23=b23+1

if HP=1 then let b24=b24+1 endif

if b23=240 then let b23=0 let b24=0 endif  'b23 should be 240

if b23>238 and b26>1 then cc  'b23 should be > 238

if b23>238 and b27>1 then bb

if b23>238 then aa

goto main

aa:

let b27=b24*35/240

goto main

bb:
let b26=b27
let b27=b24*35/240

goto main

cc:
let b25=b26
let b26=b27
let b27=b24*35/240

goto main

interrupt:
wait 1
low RSU  '--------------------------------------------------------------------End Speed-Up 4
  
return
 

Attachments

pilko

Senior Member
To simplify all this (hopefully not over simplify), I just want to reset the Picaxe via the laptop and the AXE 27 cable.

pilko
 

SD2100

New Member
You could possibly replace your WAIT 13 with the following code, it will wait for 13 seconds for the RESET command to be sent from the PC, if it dosn't arrive then it times out and continues with the program, if RESET is received then the reset command is executed and the 28x1 resets.

Code:
disconnect                                  'Stop checking for download
serrxd [13000,timeout], ("RESET")   'wait 13 seconds then goto timeout  
reset                                         'reset 28x1 if "RESET" received
timeout:                                     'no "RESET" command received
reconnect                                   'Start checking for download
 

pilko

Senior Member
Phil75, thanks for your reply. The problem is I don't know how to send a reset command from my PC. :confused:
 

pilko

Senior Member
Phil75 ---- I have inserted your code and sent "reset" from the terminal output window, but it does not reset.

regards

pilko
 

hippy

Ex-Staff (retired)
As you're re-programming the PICAXE to reset it. it obviously responds to downloads and isn't hanging or waiting for something which prevents download.

Instead of downloading, go into View -> Options, hit the "Check Firmware Version" button. That will display the version and also reset the PICAXE.
 

pilko

Senior Member
hippy said
Instead of downloading, go into View -> Options, hit the "Check Firmware Version" button. That will display the version and also reset the PICAXE.
That worked fine, thanks hippy and Phil75
I apologize for being so long winded. I must be really bad at explaining what I'm looking for
 
Last edited:

SD2100

New Member
Hippy - thats a good easy fix :).

Pilko - I should have said that when the RESET is sent from the terminal
it would have to be in upper case, RESET not reset. You can still
use this method if you want to send commands to the picaxe, eg:
to turn things ON and OFF etc.

It's also possible to reset the smaller picaxes that don't support the SERRXD or RESET commands via the download cable when not in the program editor, just send a long string of characters, this is enough to make the picaxe think there's a new download coming which results in a reset.
 

Dippy

Moderator
Sending a command from terminal was what I alluded to in Post#2 but wasn't acceptable. Has something changed?
 

pilko

Senior Member
Dippy,
When you said:
"How about if you do some code so that a particular command string from your PC makes your PICAXE code do a 'Reset' - see Manual 2.
Or similar but your PICAXE code jumps to an Initialise subroutine/block."

I thought I wasn't able to because I was using all 28 bytes. Excuse my ignorance. I know so little :confused: Why I am a senior member of this forum I have no idea. :eek:

Regards

pilko
 

SD2100

New Member
Sending a command from terminal was what I alluded to in Post#2 but wasn't acceptable. Has something changed?
Thats where I was headed in post #15 but the wheels came off when hippy suggested the firmware checker trick :D
 
Top