Page 1 of 1

12f1840 uart

Posted: Thu Mar 27, 2014 7:52 pm
by robertpatterson
1840SERIALTESTING.fcfx
(4.9 KiB) Downloaded 429 times
I am tring to get my 12f1840 uart running it works when in simulation mode but won't when programming Its most likely something stupid I am doing.

Re: 12f1840 uart

Posted: Thu Mar 27, 2014 8:41 pm
by medelec35
Hi Robert,
All the flowchart is doing is sending char0 out(Null) , which I'm sure is not want you want to do.
I can modify your flowchart for you, but im not sure what you want to do.
Would you just like to send numbers from 0 to 255 (each on a new line)?
Are you using MCLR line?
What about the osc. is it internal or external?
If external what is the vale of crystal?

I would recomend using Rs232 (UART) Hardware (Select Channel in Flowcode) rather then software.

Martin

Re: 12f1840 uart

Posted: Thu Mar 27, 2014 8:56 pm
by robertpatterson
Just tring to get started with the rs232 yes the one on the chip not the software one

Re: 12f1840 uart

Posted: Thu Mar 27, 2014 9:00 pm
by robertpatterson
I always use the internal clock never external with only a 8 pin device

Re: 12f1840 uart

Posted: Thu Mar 27, 2014 10:23 pm
by robertpatterson
Yes I was trying to get to transmit anything just to see it running I thought it would transmit the serout value
A sample code for the UART would be a big help (I am just lost getting started with the UART) Just need a kick start here.

Re: 12f1840 uart

Posted: Thu Mar 27, 2014 11:07 pm
by medelec35
Hi Robert,
First to enable 12F1840 to run with 32MHz internal osc you must add a C code block at the start of main with:
Code block for 8 or 32MHz.png
(1.96 KiB) Downloaded 4243 times
Then Configuration settings:
12F1840 config 32MHz.png
(109.12 KiB) Downloaded 4243 times
To view what RS232 is being sent in Flowcode simulator, you select Console from the View menu, then select UART - RS232 tab:
rs232 consol.png
(4.46 KiB) Downloaded 4243 times
With my 12F1840 running with int osc 32MHz.
Display on Hyperterminal (or some other serial client like Tera Term):
RS232 shown in Hyperteminal.png
(35.46 KiB) Downloaded 4243 times
Note: So configurations be correctly loaded in when you open flowchart, Its best to download the latest verson of Flowcode (6.0.6 at the time of posting) from here:
http://www.matrixmultimedia.com/mmforum ... 54&t=14600
This version is still buggy, but less buggy then 6.0.4

Martin

Re: 12f1840 uart

Posted: Fri Mar 28, 2014 12:02 pm
by robertpatterson
Hopefully it will age like a fine wine like v5 did.

Re: 12f1840 uart

Posted: Fri Mar 28, 2014 12:14 pm
by medelec35
robertpatterson wrote:Hopefully it will age like a fine wine like v5 did.
Yes I hope so too.
V5 worked great in the end.
I'm sure V6 will after the major update.
No matter the product, there will usually be teething issues.

How did you get on with with sending and viewing chars with terminal emulator and flowcode simulator?

Re: 12f1840 uart

Posted: Fri Mar 28, 2014 1:53 pm
by robertpatterson
TEST.fcfx
(5.55 KiB) Downloaded 383 times
Its all good I revisited my old program and it worked 100% 40.000khz out

Re: 12f1840 uart

Posted: Fri Mar 28, 2014 1:55 pm
by robertpatterson
I had to use pickit3.exe to program but that is good by me also.

Re: 12f1840 uart

Posted: Fri Mar 28, 2014 4:00 pm
by medelec35
robertpatterson wrote:Its all good I revisited my old program and it worked 100% 40.000khz out
Ah yes the

Code: Select all

Clock cycles used
thread?

With a much higher internal clock frequency, it no longer requires assembly :)

Re: 12f1840 uart

Posted: Mon Apr 07, 2014 1:59 pm
by robertpatterson
I built this code but the data stops short at the end no matter which way I go. maybe I am doing something wrong or its a bug I do not know.

Re: 12f1840 uart

Posted: Mon Apr 07, 2014 6:21 pm
by medelec35
Hi Robert,
The chars your sending are not making much sense to me.
If you look at a ASCII table then you will see the number 1 for example is 0x31
So if you SendChar(0x31) a 1 will be displayed via terminal software on your PC.

You are sending 0xFC, 0x18 0x00 etc.
Can you post what your trying to achieve so I can see if I can help you further.

You also need to remember the FC6 has a bug when sending ASCII string.
With FC6 you will need an extra char length, so ofr sening 2 letters you will require a string length of 3

Also you only require the Initialise before the maim loop and not inside.


Martin

Re: 12f1840 uart

Posted: Mon Apr 07, 2014 7:32 pm
by robertpatterson
That explains it then just the last charter was missing when I cut and pasted directly from my hex editor file I will have to add a random charter at the end to
get where I want to be for now.

Re: 12f1840 uart

Posted: Tue Apr 08, 2014 12:06 pm
by robertpatterson
This is what I had to do for my program to work.
seroutv2.fcfx
(5.75 KiB) Downloaded 315 times
It will not send char 00h when its inside the quotes.