Today I hate the pic more than yesterday, but its my lack of understanding and wanting to move too fast....
Hardware:
16f88 @ 4mhz
Serout on portb.6
Serin on portb.7 and also tried porta.0
T610 and a t68i
I have got working serial out into the mobile phone(s), I have 2 old datacables connected to the PC as com1 and com5, so I can use these cable ends to 'see' whats going on.
My pic is sending A,T,13 fine, I can see that on com1, the phones output is connected back to the pic and my cable to com5
I can see the phone responds with A,T,13 then a 10,O,K,13
So data is going into the phone, and being echoed out, and I'm getting valid responses (2days work this.....)
Problem is the pic does not seem to 'see' any data back from the phone, even though the max232 connected to windows can see it and is whats expected.
I tried a simple test like this..
serout portb.6,t300,["at",13]
pause 1000
serout portb.6,t300,["at",13]
pause 1000
' Send AT twice so phone can auto set baud rate
ml:
serin porta.0,n300,buf ' wait for anything from phone
toggle portb.5 ' signal something happening
pause 10
goto ml
I run the above program, I can see AT on com1 and AT OK on com5, so data was sent and phone replied, then nothing, good so far...
Now it should be at the serin command, so I call the phone, it sends out the word ''RING'', which I see on com5, so phone is sending data, but the serin command just sits and does nothing............
I have tried various settings on serin, ie N, ON, T, OT, they either dont work at all, or the LED flashes all the time.
I think the voltage from the phone (about 3.5) is too low for it to work, but I would have thought that anything above nearly 0 would count as a 1.
If you set portb to input and just run your finger near the pins you get enough noise for it to see a logic 1
Should I be looking at boosting the voltage into the pin?
I have tried a 1k pull up, and even 1k pulldown, no change.
Tried an led and resistor so I can physically see the data (well its 300 baud you can 'see' it), so I know that with no data the pin is 'high' (led lit) and when the 'ring' event occurs the led goes dim
I have seen people use a max232 from the pic, then put that into another max232 back down to the phone, seems a bit of over engineering but if thats what it takes etc.......