PIC16LF88 hardware connections for UART output

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

PIC16LF88 hardware connections for UART output

Post by christoph »

Hi all,

I cannot get a UART output signal at all from the above chip whether it be a DIL or SMD package. My Scanalogic used in signal generation mode operates the receiver correctly and gives all the right reults so the receiver is working correctly.

In Flowcode the simulation works perfectly so for a long time (before I used the Scanalogic signal generator), I was thinking that the problem lay with timing or a flowchart issue which could be sorted by tweaking in various ways but having digested everything available on that aspect of things, I still get no output. I have made several different flowcharts and lots of changes and every one of them and numerous trial changes, simulates perfectly.
Therefore, I have been forced to conclude it must be a transmitter hardware problem. However, I believe I have applied and read everything now in regard to THAT aspect of things as well, so I obviously need help (or will do soon at this rate he he! - but seriously, it is really exasperating and I have run out of ideas!

I am using a 3.7 Lithiun-Ion battery. This is how I have wired the chip:- -ve to pin 5, +ve to pin 14, UART output from pin 11 (and tried WITH and WITHOUT various pull-up and pull-down resistors from 1k to 10k), different resistor values also connected to MCLR pin 4 from +ve, 2 toggle switches connected to pins 17 and 18 from +ve as inputs - have tried with various resistor values and in pull up and pull down configuration to no avail but I ask the question here: which SHOULD it be and what value should they be?

Would be grateful for any advice on this?

Many thanks,
Chris

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: PIC16LF88 hardware connections for UART output

Post by kersing »

Please post your flowchart. And the obvious question, have you tried a 1 second flasher and does it work as expected? That would rule out oscillator setting issues as well as issues with connection of the reset pin (any pull-up is fine for that one).
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

Re: PIC16LF88 hardware connections for UART output

Post by christoph »

Hi Kersing,

Yes had done flasher and was/is ok.

Here is the flowchart - I have only included the LED's to indicate the output pictorially.
As you will ascertain, the arrangement simply locks into whichever switch is FIRST operated - regardless of any subsequent switch operations - and sends the appropriate UART number.
This is what I actually want to work but I have done a number of flowcharts with different methods aimed at doing the same thing to try and get a UART output and although every simulation worked perfectly, I still got no output.
RS232 SENDER.fcf
(9.5 KiB) Downloaded 619 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: PIC16LF88 hardware connections for UART output

Post by medelec35 »

Hi christoph,
You will need to convert data value you wish to send to a string first.
Then use SendRS232String

You can't use sendRS232Char
since that is for ascii codes.
E.g if data=13 then you are just sending a carriage return and not the number 13
This means to send a single digit like 6, you will need to send a byte of 54
Any number sent as a byte with a value of less than 33 you will not be able to see using a terminal program like tera term or HyperTerminal etc.

Also within external properties of RS232 component you need to change Simulation form Bytes to Characters.

The other thing to note is when using RS232 in hardware mode, any pins used for RX and TX will not be available for general use.
So you would not be able to use an LED connected to RB2 or RB5 as I don't believe they will work on hardware, only in simulation.

I have modified your flowchart so hopefully it will work more like its intended to.

Martin
Attachments
RS232 SENDER2.fcf
(10.5 KiB) Downloaded 614 times
Martin

christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

Re: PIC16LF88 hardware connections for UART output

Post by christoph »

Hi Martin,

Oops, I hadnt realised that 'character' was referring to an ASCII character! I see it all now! Yes, I was aware of those pins being the defaults for RS232 Tx and Rx as I dont try doing anything 'clever'with pin mods - hard enough as it is for me avoiding some of the other pit-falls!

Very many thanks for that and also to Kersing,

Cheers

Chris

christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

Re: PIC16LF88 hardware connections for UART output

Post by christoph »

Hi fellers,

Unfortunately I'm still not getting any signal from the UART output Pin 11 using the flowchart you posted Martin - I can see it SHOULD work and to that end I have bought a new breadboard and chips, checked each wire for continuity, resistance and voltages at chip pin adjacent to the package itself and supply is at 3.7 battery. It is such a simple circuit that I cant think what could be amiss. I have just programmed a new chip as a flasher and that works perfectly and is correct on live scroll of my Scanalogic analyser so I re-programmed THAT chip with the posted flowchart but no UART output signal when I input pin 17 or 18.

Any ideas?

Chris

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: PIC16LF88 hardware connections for UART output

Post by medelec35 »

Hi Chris,
I have just tried flowchart with 16F88 and after pressing switch connected to A0 got:
RS232 output.png
(29.59 KiB) Downloaded 12859 times
from HyperTerminal.
Using USB Test pod I'm getting:
RS232 output Waveform.png
(70.63 KiB) Downloaded 12859 times
So not sure why you are not getting anything from pin 11 (port B5)?
So you have scoped pin 11 and got no waveform?
I'm guessing you must have pin 4 pulled high via a resistor since the flasher had correct timings.

The only difference with my hardware is I'm using 5V

My suggestion would be to place just after the c code block a continuous loop so RS232 is never accessed.
Have a one second flasher on pin 11 that only flashes when port A0 or port A1 goes high.
At least then you are testing all the hardware first.
It could boil down to A0 or A1 not going to logic 1 when it should be.

Martin
Martin

christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

Re: PIC16LF88 hardware connections for UART output

Post by christoph »

Hi Martin,

That is exactly what I hope to be able to achieve eventually re your pictorials!

Yes I have pin 4 pulled hi via 6.8k resistor and it is certainly doing its job ok re when chip programmed as a flasher. Have also similar value resistor as pull down to pins A0 and A1 switches (have tried with higher and lower resistors and even none at all). Thought maybe my logic analyser was not working but appears to be ok as it picks up the high and low pulses from the flasher AND if one purposely makes 'noisy' connection with two stranded wire ends. However, what I DO see is that sometims when I operate the switches the signal goes high - continuously - which one might interperate as a very high frequency pulse rate which Scanalogic cant see or decode but I cant see anything that would be causing that. I have only got a very old - possibly 40 year - scope buried in loft somewhere and I think it had a problem anyway so not able to see any waveforms to help. Anyway I will do as you suggest and check the switches - probably tomorrow now. What is very curious though, is that I breadboarded this and with a receiver using the flowchart I initially post ed 'above'for the transmittr and it all worked perfectly and now I cant see how it could have done so!

Fingers crossed it is to do with the switches!

Thanks for your suggestion,

Chris

christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

Re: PIC16LF88 hardware connections for UART output

Post by christoph »

Hi Martin and all,

Have only just been able to come back to this and in spite of using Martins flowchart and then trying out the suggestion to test the switches ( and actually I didn't get any reaction which seems to show something amiss anyway ) I still get no UART signal although I DO GET a constant high of 4.5 volts (the voltage I am now trying with ). I realise something is wrong but I have a new breadboard again, new wiring (each one tested individually although there is very little wiring or complication involved anyway) and all the rules for PICs checked and double checked. I have brand new chips and they are wired as they should be ( as per my very first post under this heading ). I suspected my logic analyser at one stage but have checked flasher and various other projects and reading ok - also proven by jiggling it on and off the positive supply and seeing it pulsing between 0 and 4.5 volts.

I am really baffled and I must be missing SOMETHING here whatever it is - it is such a SIMPLE set up and yet I have tried everything I can think of : there must be a reason ! Any further thoughts would be very gratefully received....

Thankyou ,

Chris

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: PIC16LF88 hardware connections for UART output

Post by medelec35 »

Hi Chris,
christoph wrote:I still get no UART signal although I DO GET a constant high of 4.5 volts (the voltage I am now trying with ).
TX output is normally high when no data is being sent.
My suggestion would be to leave out the switches for now and just keep sending RS232 string "U" say every 100 ms
See if you can see any activity?

Martin
Martin

christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

Re: PIC16LF88 hardware connections for UART output

Post by christoph »

Thanks Martin,

I will give it a try ........

christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

Re: PIC16LF88 hardware connections for UART output

Post by christoph »

Hi Martin,

Have programmed PIC to simply send "U" and nothing happening out of Tx B5 but voltage goes to continuous 4.5 and logic analyser is stating baud rate as zero. Simulation sending U,U,U,U, etc correctly.I have checked connections at the chip pins (where they go into the plastic moulding and they are all ok!). Don't know how much simpler the wiring could be really as just +ve, -ve, 6.8k resistor to +ve from MCLR to pin 4 and UART out of pin11 to logic analyser. Have even tried pull-down resistor on the UART but no difference. This is really strange....

christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

Re: PIC16LF88 hardware connections for UART output

Post by christoph »

This is the modified flowchart
RS232 SENDER re MARTIN WITHOUT SWITCHES.fcf
(8.5 KiB) Downloaded 481 times

christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

Re: PIC16LF88 hardware connections for UART output

Post by christoph »

Hi Martin,

I notice you say you used an F88 chip - a DIL package I assume as well! However, I am using an (L)F88 DIL on the breadboard and the surface mount (F)F88 on my PCB - I am led to believe ther is no major difference between the two but could there be something suttle - if so I can't see it!

Also, my logic analyser is showing a baud rate of 4800 as oppose to the 9600 re Flowchart so maybe a baud rate problem and that brings me round to this question of the (L)F version maybe?

Any thoughts on this would be useful....

Many thanks

Chris

christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

Re: PIC16LF88 hardware connections for UART output

Post by christoph »

Hi all - INEXPLICABLE UPDATE....

For some baffling reason and after all this time, I am now getting UART signal output on the self same chips I was getting nothing from previously i.e. the PIC16(L)F88 !!! So, if I transmit the number say, 34, my logic analyser showsthe transmission of two ASCII codes 51 and 52 which I now recognise as 3 and 4 (or the number 34). The attachment is the simplified form I have been using. However, I cant seem to get how to receive that ASCII code and reproduce the 34 as a number on a hardwired receiver PIC16(L)F88. Could someone possibly post a receiver flowchart to do that. The RS232 component macro doesn't like what I put in having selected RS232, Receive string....!

I also see that Martins (and this attachment as I used the same basics) flowchart is at 2400 baud rate with int oscillator running at 4 megs. However, when this is working ok, I will be using WIRELESS Tx/Rx which has built-in baude rate requirement of 9600, instead of hard wiring. If I try using 9600 baud rate in flowchart it works fine but not on the breadboard. I am not very up with baud rates and oscilator settings but is there some way I can get the 9600 for the transmission. My logic analyser says the baud rate IS 2400 so I am only 25% of what the transceivers require.

Chris
RS232 SENDER - working.fcf
(5.5 KiB) Downloaded 428 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: PIC16LF88 hardware connections for UART output

Post by medelec35 »

Hi Chris,
christoph wrote:I am not very up with baud rates and oscilator settings but is there some way I can get the 9600 for the transmission
If you right click RS232 on the control panel you can select Ext properties.
There you can change the baud rate.
Note: If selecting Ext properties and no addition window appears, then just click Run then stop and try again.
I can help you with your receiver, but you need to bear in mind that 1 chat is transmitted and received at a time.
So if you want for example 37 in a variable, we will need to have a time out function so 3 is assigned then 7 is assigned and then the variable is cleared.
Then if just a 2 is required the variable is used then cleared.

Another way would be to send a comma after each values. e.g 37,2,180 etc
then the variable can be used once a comma is received.
This would allow design of the receiver to be a simpler.

If you develop the receiver with what you want it to do after receiving a number within a variable, I will add all the RS232 parts to it.

Martin
Martin

christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

Re: PIC16LF88 hardware connections for UART output

Post by christoph »

Hi Martin,

Sorry, I wasn't ignoring your much appreciated last reply - I have had major computer problems and only just up and running again now,

If I may take up your offer of help with the RS232 aspect where I cant seem to get the signal receipt set up right, that would be really good.

The transceivers are configured for 9600 baud, 8 data bits, 1 stop bit and no parity.

You will see the intended operation from the flowcharts but a couple of points here:
a) I have put in the one second delay at the beginning of the transmitter flowchart because It is powered from button cells and I dont want to be using ANY power until it is activated via one of the switches. It caters for a pretty 'dirty' switch signal (even just touching to bare wires togather - and the switches I use are high quality anyway). I mention this because I seem to still have difficulty getting the HI input onto the relevent pins to work at all. I have tried every which way in hardware with pull down resistors, no resistor etsc. and I wonder if I have something amiss in the flowchart - although it simulates perfectly.
b) Yep, I knew how to get the 9600 baud selected in the flowcharts but I could not get the UART signal out until I tried your posted chart (when it suddenly decided to output ANYTHING at all and I noticed it was at 2400 baud and went with it. I had a bit of intermittent success but it was giving rather strange numbers and so I reverted back to 9600 baud ( which I need to run at anyway ) at which point it worked EXACTLY right by outputting the two ASCII numbers in the string - ONCE!!! Haven'tr got it to do it since. I keep thinking it is the logic analyser but whenever I try it on other projects it seems ok. If you can kindly sort the receiver UART out, I can test the Tx and Rx together .
c) On the receiver, you will see I also need to send the same received signal out again as a UART to another PIC16(L)F767 to be received in the same way.

Both of these simulate fine so hope this doesn't put you to too much trouble,

Many thanks '

Best regards

Chris
UART TRANSMITTER.fcf
(10 KiB) Downloaded 446 times
UART TRANSMITTER.fcf
(10 KiB) Downloaded 446 times
Attachments
UART RECEIVER.fcf
(19.7 KiB) Downloaded 413 times

christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

Re: PIC16LF88 hardware connections for UART output

Post by christoph »

OK,
I think I have sorted it out now but I have a final issue which is under my new posting "Not getting the ASCII codes expected for 2 out of the 3 bytes sent".

Could someone have a look at my new posting and point to a remedy?

Regards

Chris

Post Reply