12f1840 uart

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
User avatar
robertpatterson
Posts: 44
Joined: Thu Feb 21, 2013 2:16 am
Location: New England
Been thanked: 6 times
Contact:

12f1840 uart

Post by robertpatterson »

1840SERIALTESTING.fcfx
(4.9 KiB) Downloaded 333 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.

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: 12f1840 uart

Post 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
Martin

User avatar
robertpatterson
Posts: 44
Joined: Thu Feb 21, 2013 2:16 am
Location: New England
Been thanked: 6 times
Contact:

Re: 12f1840 uart

Post by robertpatterson »

Just tring to get started with the rs232 yes the one on the chip not the software one

User avatar
robertpatterson
Posts: 44
Joined: Thu Feb 21, 2013 2:16 am
Location: New England
Been thanked: 6 times
Contact:

Re: 12f1840 uart

Post by robertpatterson »

I always use the internal clock never external with only a 8 pin device

User avatar
robertpatterson
Posts: 44
Joined: Thu Feb 21, 2013 2:16 am
Location: New England
Been thanked: 6 times
Contact:

Re: 12f1840 uart

Post 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.

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: 12f1840 uart

Post 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
Attachments
1840SERIALTESTING.fcfx
(6.61 KiB) Downloaded 243 times
Martin

User avatar
robertpatterson
Posts: 44
Joined: Thu Feb 21, 2013 2:16 am
Location: New England
Been thanked: 6 times
Contact:

Re: 12f1840 uart

Post by robertpatterson »

Hopefully it will age like a fine wine like v5 did.

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: 12f1840 uart

Post 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?
Martin

User avatar
robertpatterson
Posts: 44
Joined: Thu Feb 21, 2013 2:16 am
Location: New England
Been thanked: 6 times
Contact:

Re: 12f1840 uart

Post by robertpatterson »

TEST.fcfx
(5.55 KiB) Downloaded 323 times
Its all good I revisited my old program and it worked 100% 40.000khz out

User avatar
robertpatterson
Posts: 44
Joined: Thu Feb 21, 2013 2:16 am
Location: New England
Been thanked: 6 times
Contact:

Re: 12f1840 uart

Post by robertpatterson »

I had to use pickit3.exe to program but that is good by me also.

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: 12f1840 uart

Post 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 :)
Martin

User avatar
robertpatterson
Posts: 44
Joined: Thu Feb 21, 2013 2:16 am
Location: New England
Been thanked: 6 times
Contact:

Re: 12f1840 uart

Post 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.
Attachments
SEROUT1.fcfx
(7.6 KiB) Downloaded 195 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: 12f1840 uart

Post 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
Martin

User avatar
robertpatterson
Posts: 44
Joined: Thu Feb 21, 2013 2:16 am
Location: New England
Been thanked: 6 times
Contact:

Re: 12f1840 uart

Post 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.

User avatar
robertpatterson
Posts: 44
Joined: Thu Feb 21, 2013 2:16 am
Location: New England
Been thanked: 6 times
Contact:

Re: 12f1840 uart

Post by robertpatterson »

This is what I had to do for my program to work.
seroutv2.fcfx
(5.75 KiB) Downloaded 263 times
It will not send char 00h when its inside the quotes.

Post Reply