help serial out as an output

lake

New Member
hi i am using a picaxe 40x1 ad ive used all the outputs and yet i still need one more i was looking on the net and found that i could use the serial out as one im not quite sure how can anyone help me please
i know that the code is someting like


main:
poke $05,%00000000
pause 1
ect......



Edited by - lakey009 on 15/07/2007 10:25:32
 

lake

New Member
when running the simulation on a picaxe 18 this code works

player1:
gosub toggleball
poke $05,%00001000
pause 1000
poke $05,%00000000
pause 2000
goto main

but when i copy it into the 28x1 mode for my 40x1 is come up with an error saying

poke at this address is not recommended and will not correctly simulate

Edited by - lakey009 on 15/07/2007 10:43:25
 

hippy

Technical Support
Staff member
If you look at the 40X1 pinout in PICAXE Manual 1 Serial Output is on Leg 7, look in the 16F886/16F887 datasheet and Leg 7 is RA5, bit 5 of PORTA.

To control that leg the code would be -<code><pre><font size=2 face='Courier'> ; Bit 76543210
POKE $05,%00000000 ; Serial Out = 0
POKE $05,%00100000 ; Serial Out = 1 </font></pre></code> DPG summed it up nicely - Poking SFR's can lead to incorrect operation and can even destroy hardware if done wrongly. Simulators rarely emulate the full nuances of poking internal SFR's ( not even Microchip's MPLAB ) and it really requires a good knowledge of the internal workings of the PICmicro and an understanding why something should work rather than just guessing at a solution which could work. In this case setting all the bits probably doesn't have any adverse effects, but it's always best to have proven that as best one can before trying it.

Full marks for logical deduction and getting stuck in. One gold star taken away for not knowing if any damage would be caused or not :)
 

lake

New Member
yes thanks alot for your help code has ben changed just doing some cable tidying on the bread board thanks
 
Top