PDA

View Full Version : Serin with low voltage



f_lez
- 20th August 2006, 22:53
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.......

mister_e
- 20th August 2006, 23:11
http://www.picbasic.co.uk/forum/showpost.php?p=24457&postcount=6

Also, you have a free USART in your PIC, you should use it. HSEROUT, HSERIN instead. But you have to use the dedicated pins PORTB.2 and PORTB.5

f_lez
- 21st August 2006, 08:06
http://www.picbasic.co.uk/forum/showpost.php?p=24457&postcount=6

Also, you have a free USART in your PIC, you should use it. HSEROUT, HSERIN instead. But you have to use the dedicated pins PORTB.2 and PORTB.5

Yes I've just never used the hardware one before, and never had problems with the serial one before, and I have all the analog side switched off, and it wont even work on purely portb


I'm going to drag out the scope later and see just whats going in, no reason exists for it not to work, except voltage, so its annoying me now!

if the damn thing had worked like I guessed it would(!) I would be sat back woth a working toy now!

f_lez
- 21st August 2006, 11:52
http://www.picbasic.co.uk/forum/showpost.php?p=24457&postcount=6

Also, you have a free USART in your PIC, you should use it. HSEROUT, HSERIN instead. But you have to use the dedicated pins PORTB.2 and PORTB.5



lol

I really do have code blindness.........

I owe you a great thankyou, or apology for disbelief, but even though I had included lines to switch off the analog stuff I had one with a little mistake in it, and I had looked at it at least a 100 times as I scrolled down to where I thought the fault was................

The 'thing' now works a treat, and I have real data going back in on porta, now to shift it to port b......

(edit)
I have moved the code to port b, and it now works, which explains nothing, as even with analog enabled on port A, port B should work just the same! agh!