Serial data

kam

Member
Hi all,

Im sort of new to Picaxe. I was trying to send some serial data from my 28X to the coms port. What I was trying to achieve was to send a string to ask for a number. That number would then be used as a counter limit to flash an LED. I couldnt get it running but i also noticed that on my coms to USB dongle the Rx LED stays constantly ON. May be its not letting any data back in. I am using a MAX 232 converter in the middle. Also the CTS and RTS have been grounded and Im using an 8MHz Clock. I have already seen all the other links related to the Serial Coms, but i dont see the problem. I sure im missing out on a small bit... Its always the case. Heres the code:

;Connections:
;Pin Out1 to SerTx
;Pin Out2 to LED
;Pin Out3 to SerRX
;-----------------------

main:

let b1 = 0
let b2 = 0
serout 1, N4800,("Please Enter The Number Of Times You Want The LED To Flash: ")
pause 250

datain:
serin 3,n4800, b2
wait 2

datacheck:
if b2 > b1 then goto flash
goto datacheck

flash:

for b3=0 to b2
high 2
wait 2 ; with 8 MHz clock the cycle is half the requested time, Hence 1 Sec.
low 2
wait 2
serout 1,N4800,("LED Flashing from 1 to : ",#b3,lf)
next b3

serout 1,N4800,("LED Flash Complete ",lf)
pause 500
goto main


Hope this helps
Thanx
 

kam

Member
i should have mentioned, I tried that too. No difference. I can read the message being sent to the Terminal but cant get any massage through to the micro.
thanx
 

hippy

Senior Member
You may have to disable handshaking for whatever comms program you are running onthe PC. You'll want "No Handshaking" rather than "Hardware handshaking CTS/RTS" or "Software (X-ON/X-OFF) Handshaking".

Also, when typing a number for the PICAXE remember to press return after it :)
 

moxhamj

New Member
What program are you using on the PC? I am a bit confused by the problem still - is it PC to micro or micro to PC? Have you read http://www.instructables.com/id/Control-real-world-devices-with-your-PC/

I'm sure we can troubleshoot it but the problem needs to be isolated more. At the very simplest level leave out the picaxe and run a VB.Net program or hyperterminal program to send out one byte and read that byte back and simply connect pin 2 and 3 together. This at least will test the USB dongle works. RTS and CTS shouldn't be connected to anything.

Does the USB device work for programming a picaxe? If so then lots of things are already working.
 
Last edited:

kam

Member
What program are you using on the PC? I am a bit confused by the problem still - is it PC to micro or micro to PC? Have you read http://www.instructables.com/id/Control-real-world-devices-with-your-PC/

I'm sure we can troubleshoot it but the problem needs to be isolated more. At the very simplest level leave out the picaxe and run a VB.Net program or hyperterminal program to send out one byte and read that byte back and simply connect pin 2 and 3 together. This at least will test the USB dongle works. RTS and CTS shouldn't be connected to anything.

Does the USB device work for programming a picaxe? If so then lots of things are already working.
Hi,
Yes the USB device works well for programming the Picaxe. i also used it to transmit data to COMS sucessfully. I use the Pixace Programing Editor Terminal. So i think, for standard issue it should respond.
i'll try your suggestions one by one and will update the result
 

andrew_qld

Senior Member
I had some serial probelms with a 28X1 recently. Two things to check, first make sure the power supply is well filtered (100uF electro) and if it still won't work, try using a diferent resonator.

The 28X1 I had would do fine using ts internal resonator at 2400 baud but not 9600. I put a 16 MHz resonator in and it all worked.
 
Top