Can the low bits of PORTB be used with LCD

Status
Not open for further replies.

camerart

Well-Known Member
Hi,

I'm trying to get the RX and Tx to work on a 16F648A PIC with an LCD. The LCD data pins are connected to PORTB high byte. The RX is working ok, but the when the TX outputs it's signal, the voltage is 0 to app 1V swing. I've tried switching TX on and off but this has the same result. So can the Tx be used when an LCD is connected this way?

Camerart.
 
You can connect any output pins to an LCD (you don't need input ones, unless you're reading the busy signal, but it's simpler to use delays instead, and saves an I/O pin).

However, I'm not really very clear what you're doing, or how you have everything connected - but the most common problem is not disabling unused hardware (such as the comparators or analogue inputs).

Incidentally, I tend now to connect the LCD to PortA as most of the hardware I'm using uses PortB.
 
I used to have a great deal of problems using Oshonsoft's 4 bit LCD interface.... I always ended up writing my own...
 
Hi I and N,

Here's a JPG on the pinouts. The Data lines are connected to PORTB H and the TX and RX are connected to PORTB L The LCD is working fine, the BUTTON and RX are ok, but the TX shows an output, but it it only 0V to 1V swing. I've tried pullups switching ,but it is stuck on 1V max.

It is for a portable GPS NMEA output.

C
 

Attachments

  • 16F648A LCD pinouts.jpg
    9.5 KB · Views: 188
Have you the code... I'll see if I can get it working for you...
 
Is the Tx pin output to or input from gps ?
Is the data direction register set correctly ?
If receiving works, is Tx needed ?
 
Have you the code... I'll see if I can get it working for you...

Hi I,
Code attached.
Note:
It simulates ok for me.
You will need an NMEA sentence for the UART input: $GPGGA,185052.00,5044.12467,N,00146.05788,W,1,06,4.51,10.0,M,47.4,M,,*7? This has a '?' at the end.
3x changes between SIM and CIRCUIT (Comment in/out Simulation value) Change commented out lines for 'LF' or '?'

Good luck.
C.
 

Attachments

  • PIC 16F648A 4MHz INT NMEA LCD 230316 0800.txt
    3.9 KB · Views: 240
Is the Tx pin output to or input from gps ?
Is the data direction register set correctly ?
If receiving works, is Tx needed ?

Hi J,
RX receives NMEA sentences ok. I only need 1x type of sentence, so the program parses out the one I want and outputs it to TX.
C.
 
Have you measured the Tx voltage the Usb cable disconnected?
Hi J,
The USB cable is fine. With nothing connected to the TX pin, the voltage is wrong. There is nothing else connected to that pin.
C.
 
Works here.... The only thing I had to change was there was no LF (0x0A ) so I changed it to CR (0x0D)
It spitsout onto the screen and back out to Hyper terminal!!
 
Works here.... The only thing I had to change was there was no LF (0x0A ) so I changed it to CR (0x0D)
It spitsout onto the screen and back out to Hyper terminal!!

Hi I,
I'm puzzled about lack of LF. Did you follow what I said in #7?
[[[ Hi I,
Code attached.
Note:
It simulates ok for me.
You will need an NMEA sentence for the UART input: $GPGGA,185052.00,5044.12467,N,00146.05788,W,1,06,4.51,10.0,M,47.4,M,,*7? This has a '?' at the end.
3x changes between SIM and CIRCUIT (Comment in/out Simulation value) Change commented out lines for 'LF' or '?' ]]] Or did you have to add another LF/CR? If so where?

Assuming that you changed those lines, then the problem is at this end. Do the RB2 and RB3 lines go ON/OFF (to 5V) at the start also, as the program dictates?

EDIT: I have just tried a PORTB ON PORTB OFF routine at the beginning of the program and all of PORTB switch 5v-0V then once the program starts it reverts to 1V-0V at TX

C.
 
Last edited:
Sounds like a large current draw on the tx pin..

Hi I,

There's nothing connected. If I remove the PIC, there is no resistance.

Thanks for trying Ian, I'll leave it now. I can parse out the NMEA sentence from the GPS output, it is just a bit more effort.

Thanks, C.
 
How did you measure the voltage?
With oscilloscope or digital voltmeter?
The voltmeter shows some average voltage between
0 and 5V when tx is transmitting.
 
Hi Both,

I used a voltmeter and an oscilloscope, RX 0 to 3.5V TX 0 to 1V.

I tried 4x PICs. And tried the previously mentioned PORTB =1 which showed 5V.

This is only a handy pocket display, and the TX output was an after though, so I'll acceot it as it is.

Thanks, C.
 
Hi Both,

I used a voltmeter and an oscilloscope, RX 0 to 3.5V TX 0 to 1V.

I tried 4x PICs. And tried the previously mentioned PORTB =1 which showed 5V.

Like I said above, you're probably not setting the pin correctly - that's almost always the reason for 'strange' problems
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…