Would This work? If so, need advice

buntay

Senior Member
Greetings ladies and gentlemen, its me again.

Here is the latest project. I would like to dial into a remote picaxe using this http://www.radi.com/modular40.htm then be able to upload a program onto this http://www.ebay.com/itm/JP-Module-Basic-Stamp-Picaxe-Arduino-SD-Card-data-/170735872628?pt=LH_DefaultDomain_0&hash=item27c0a6aa74 which will be an encapsulated module and have picaxe run the program from there.

The reason behind this is the controller may be many,many miles away and may not be able to justify a 3 day drive for a 30 second firmware upgrade. Since this is proprietary firmware I would not like anybody to see it, which is why the SD module is encapsulated.

is this setup possible? I did some forum searching but haven't really found a definitive answer.

as always any help, insight, and/or advice is greatly appreciated.

Buntay
 

hippy

Ex-Staff (retired)
I would like to dial into a remote picaxe using this http://www.radi.com/modular40.htm
That should be okay. The PICAXE can detect the ring signal or ring message, enable the connection and start chatting. Auto-answer may make that quite easy. Any external modem with RS232 should be able to do the job.

It will be handy to have a PABX to hand for testing to save connection costs on calls.

Should also work if you can figure a way to get a PICAXE 'program image' from something to the PICAXE via the modem.

I'm not sure how you are planning to do that but it is technically feasible though possibly not as easy as you are imagining.

which will be an encapsulated module and have picaxe run the program from there.
I think you'll have to detail how you mean by "run the program from there".
 

buntay

Senior Member
Thanks Hippy for the prompt reply.

I think you'll have to detail how you mean by "run the program from there".
Thats just it, just how far can i go with it? I mean,

if I have a base program with this
if b0= 150 then low C.1
and I need to change the "150" to "200" I would need the base program to look on the card for this number. simple rambling in my mind I have it figured out with something like.

main:
look on the card and b.1 = blah
if b0 = b1 then low c.1
goto main
granted I have to tell the program where on the card to find it but this part I assume would be easier that adding a completely new command. like
main:
if b0=b1 then low C.1 ' original code
if c.1 = 1 then high C.2 ' new code added later and uploaded through modem
goto main

the question then becomes is this possible?
if so, how, anybody done anything close?
 

MPep

Senior Member
Ok, so you want some variables changed, remotely, and then use those in an existing program? Correct?

This is indeed easy enough to do.
Create a sub-routine or an interrupt to deal with the infrequent dial-ins and store the new value.
In your main program just read the variable from the memory location and use accordingly.

I used something like this
Code:
'--------SBD receive text message-------
Receive:
    serout TpinO,Tbd,("AT+SBDRT",13,10)             ' Tell 9601 to transmit MT buffer
    serin TpinI,Tbd,("SBDRT:"),b0,b0,b0,b1,b2,b3,b4,b5    ',b6,b7,b8,b9
    low PCS
    sertxd ("RECEIVE BUFFER DATA",13,10,"b0",32,b0,13,10,"b1",32,b1,13,10,"b2",32,b2,13,10,"b3",32,b3,13,10,"b4",32,b4,13,10,"b5",32,b5,13,10,"b6",32,b6,13,10,"b7",32,b7,13,10)'b8,b9,"b10",b10,13,10)
    if b0 = "U" then gosub Time_change

return

Time_change:

    poke $75,b1
    poke $76,b2
    poke $77,b3
return
The above code was then followed by
Code:
Timecheck:
    serin GpinI,Gbd,("GPZDA,"),b1,b2,b3,b4
    
    peek $50,b5
    peek $51,b6
    peek $52,b7
    peek $53,b8
    
    sertxd (b1,b2,b3,b4,b5,b6,b7,b8,13,10)
    
    if b1 = b5 and b2=b6 and b3=b7 and b4=b8 then timeup

    goto Timecheck
    
timeup:
return
Please note that this is part of a much larger code. The 9601 is a satellite modem made by Iridium, now superseded by the 9602. The project also had a GPS for accurate positioning and timing. Hope this helps.
 

hippy

Ex-Staff (retired)
You could do it as an interpreter but it's all quite complex.

It's worth stepping back and asking do you really need to do any of this; is anyone else seeing the source code really as much of a problem as imagined, and if so, is there an easier way to do it where disclosure of source code would not really help them ?

One option would be a dual PICAXE system and the first is programmed not with "HIGH C.1" and so on but using SERTXD("5d") or something similarly cryptic. Unless they know what's in the secret PICAXE knowing what's in the publicly open one isn't very useful. If using 28X2 or 40X2 then you could split the program between programs slots so they'd never have the full program, code that so you only ever have to update one slot.

Another option is to use one PICAXE as "configuration" for another, replacing the SD module, program it as usual, but that won't help if you want to alter the master program.

Don't forget that most security is deterrent and delaying tactics and won't stop determined reverse engineering. The best you can hope is that the obstacles outweigh the willingness to put in that effort.

I think the idea falls under the general category of remote programming PICAXE which is possible but an awful lot of work - though it would be easier with a 28X2 and I2C Eeprom and forgetting about using the SD Card completely.
 

MPep

Senior Member
@Hippy,

Not sure what is really required here, as in #3 there is mention of changing a variable, although in #1 there is mention of re-programming the whole firmware, which is a totally different, and more in-depth, thing.
 

g6ejd

Senior Member
I'd pre-write all of the routines / logic you need in your current picaxe and use another picaxe with a simple routine to receive data from the phone line and change pin states that are then read by the other picaxe to vary the operation. Conversely, use the secondary picaxe to serial over received data to the controlling picaxe.

If the remote unit has web access a picaxenet unit would be very easy to use.
 
Top