Baud rate out with HiTec Compiler

Moderator: Benj

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

Baud rate out with HiTec Compiler

Post by medelec35 »

I have been playing with Hitec and bit banging RS232. With osc at 8MHz
The baud rates are way out.
e.g in rs232.c
for

Code: Select all

#define %m_SW_BAUD   %r - 20		//Under 10MHz
Baud = 497
For

Code: Select all

#define %m_SW_BAUD   %r - 255			//Under 10MHz
Baud = 1219

Since 255 is maximum variable can be, what would I need to adjust to get baud at a higher rate please?

Martin
Martin

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

Re: Baud rate out with HiTec Compiler

Post by medelec35 »

I’m guessing I am looking to change %r which currently set to 416?
Unfortunately I can't determine where the 416 is assigned. :(
Last edited by medelec35 on Thu Nov 10, 2011 8:54 pm, edited 1 time in total.
Martin

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

Re: Baud rate out with HiTec Compiler

Post by medelec35 »

I’m assuming %r is calculated from required baud rate.
To give an idea on value of %r. I have got the baud rate of 2400 spot on by changing #define line to

Code: Select all

#define %m_SW_BAUD  79

This would imply HiTec bitbang RS232 is miles off from BoostC.
Therefore I would guess there would have to a separate defines for Boostc and HiTec .


Martin
Martin

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Baud rate out with HiTec Compiler

Post by Benj »

Hi Martin,

I will make a note to have a good look into this for hitech and boostc for the v5 CAL code as it allows any component that uses a UART to tap into the hardware/software UART functionality. Hopefully we can get something more reliable across the board.

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

Re: Baud rate out with HiTec Compiler

Post by medelec35 »

Thanks for reply Ben
I have done some further tests on just using boostC.
I have used two frequencies and two different baud rates
Here are results I had to adjust RS232 component to, in order for RS232 baud rates to be spot on.

Code: Select all

Freq      Baud         Value
4MHz	  2400          %r  - 80	Therefore if default  is 	%r  - 58, then %r should be 434 etc
4MHz	  4800          %r  - 54
8MHz	  2400          %r  - 40								
8MHz	  4800          %r  - 27
Would you mind letting me know a way I can set it up so %r can be reclulated for the different baud rates and different frequencies please and not just different baud rates.

Thanks
Martin
Martin

Post Reply