- 1840SERIALTESTING.fcfx
- (4.9 KiB) Downloaded 333 times
12f1840 uart
Moderator: Benj
- robertpatterson
- Posts: 44
- Joined: Thu Feb 21, 2013 2:16 am
- Location: New England
- Been thanked: 6 times
- Contact:
12f1840 uart
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.
-
- 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
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
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
- robertpatterson
- Posts: 44
- Joined: Thu Feb 21, 2013 2:16 am
- Location: New England
- Been thanked: 6 times
- Contact:
Re: 12f1840 uart
Just tring to get started with the rs232 yes the one on the chip not the software one
- robertpatterson
- Posts: 44
- Joined: Thu Feb 21, 2013 2:16 am
- Location: New England
- Been thanked: 6 times
- Contact:
- robertpatterson
- Posts: 44
- Joined: Thu Feb 21, 2013 2:16 am
- Location: New England
- Been thanked: 6 times
- Contact:
Re: 12f1840 uart
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.
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.
-
- 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
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: Then Configuration settings: To view what RS232 is being sent in Flowcode simulator, you select Console from the View menu, then select UART - RS232 tab: With my 12F1840 running with int osc 32MHz.
Display on Hyperterminal (or some other serial client like Tera Term): 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
First to enable 12F1840 to run with 32MHz internal osc you must add a C code block at the start of main with: Then Configuration settings: To view what RS232 is being sent in Flowcode simulator, you select Console from the View menu, then select UART - RS232 tab: With my 12F1840 running with int osc 32MHz.
Display on Hyperterminal (or some other serial client like Tera Term): 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
- robertpatterson
- Posts: 44
- Joined: Thu Feb 21, 2013 2:16 am
- Location: New England
- Been thanked: 6 times
- Contact:
-
- 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
Yes I hope so too.robertpatterson wrote:Hopefully it will age like a fine wine like v5 did.
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
- robertpatterson
- Posts: 44
- Joined: Thu Feb 21, 2013 2:16 am
- Location: New England
- Been thanked: 6 times
- Contact:
- robertpatterson
- Posts: 44
- Joined: Thu Feb 21, 2013 2:16 am
- Location: New England
- Been thanked: 6 times
- Contact:
-
- 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
Ah yes therobertpatterson wrote:Its all good I revisited my old program and it worked 100% 40.000khz out
Code: Select all
Clock cycles used
With a much higher internal clock frequency, it no longer requires assembly
Martin
- robertpatterson
- Posts: 44
- Joined: Thu Feb 21, 2013 2:16 am
- Location: New England
- Been thanked: 6 times
- Contact:
Re: 12f1840 uart
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
-
- 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
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
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
- robertpatterson
- Posts: 44
- Joined: Thu Feb 21, 2013 2:16 am
- Location: New England
- Been thanked: 6 times
- Contact:
Re: 12f1840 uart
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.
get where I want to be for now.
- robertpatterson
- Posts: 44
- Joined: Thu Feb 21, 2013 2:16 am
- Location: New England
- Been thanked: 6 times
- Contact:
Re: 12f1840 uart
This is what I had to do for my program to work.
It will not send char 00h when its inside the quotes.
It will not send char 00h when its inside the quotes.