Yesterday I wrote a simple program


Loop:

high porta.0
pause 500
low porta.0
pause 500
high porta.0
pause 500
low porta.0
pause1000

serout porta.1, N9600,["AT",13,10]

goto loop.


simple, flash led and send AT down a 1k resistor to my serial port.

Worked a treat. left hyperterminal running and showing AT for hours...


Got an old phone datacable, hacked into the wires, its only a max232 in a moulded plug, connect it to the pic, looked at monitor, nothing on screen, occasional garbage......

How can this be? the simple and dirty resistor trick works, the 'proper' way with a level shifter isnt working?

Ha! I should use T9600.............

Nothing.....

OT9600, nothing.

Back to the simple resistor, all is fine, so I have not upset the pic.....

9600 on a 4mhz, emm, I'll drop to 4800, oh hang on compiler error, better make that 2400..........


Maybe I have killed the old phone data cable?

get another one! this ones not a max 232 but a pl203 usb one, nothing......

Reconnect them up and test them on the phone, thats ok.

connect the two datacables together! put one on com 1 and the other on 5, oh look what I type in one window appears in the other!

Connect both to the pic, nothing.............garbage............

At this point I was going to go sit in the garden and break out a beer.

I decided it must be voltage levels, so started to play with a 1k resistor between pin Ra1 and gnd and 5v, no real improvement, very odd...

I remember something about port A pullups and problems, so I changed to code to serout on portb.6.........

That was it, all problems fixed.......

At this point I dont care anymore, I'll just never use port A again!

Odd that even on portb, using no pullups or anything both OT2400 and T2400 appear on both the max232 and the pl2303

Best news is I have connect the pic to my phone, and one of the cables, and can see the phone echoing back whats sent, so I'll soon have my house/car alarm....