Serial input over download cable (08/08M)

bbas

New Member
If somebody wants to control a Picaxe 08 over the download pin it can be done as follows.

If you just want to sent a command

Code:
serin 5,N2400,("CMD") ' "CMD" can be of any length
If you want to pass variables
Code:
serin 5,N2400,("1234"),b8      ' "1234" must have not less than 4 chars
It seems while the serin code parses the input for the string the bootloader is disabled.
This is why if you use this method you cannot download a program while the code waits in serin.

Drawbacks:
  • You cannot download while in serin.
  • If you sent something to the port while not in serin you enable the bootloader and reset the program getting garbage on output 0.
  • But you can exploit that last as a reset feature over the serial

The trick works for sure on picaxe08 firmware version 4.3.
08M behaves erratically and needs further investigation.


I suggest you USE A PAUSE 2000 command in the beginning of the code if you will use this trick!!!
This way even if you will have a looped serin you will be able to reprogram the chip on power on during the 2 sec pause.

Good luck :)
 
Last edited:

hippy

Technical Support
Staff member
An abridged version of the response in the original discussion thread ...

http://www.picaxeforum.co.uk/showthread.php?t=11562

The only supported mechanism for reading serial in via the download port is by using the SERRXD command ( not available for the 08/08M ).

While SERIN on pin 5 appears to work in some circumstances it is not recommended as it is still possible to inadvertently cause a download reset if data is sent while not executing the SERIN and behaviour could be power supply and temperature sensitive. As the internal oscillator changes frequency the chip's behaviour may differ and it may work one day and not the next, it may work with some PC's but not others. Operation is not guaranteed for future firmware versions.

Non-existent and invalid pin numbers should not be used in any command as behaviour in such cases is not defined.
 
Last edited:
Top