Hi,
Can anyone please tell me what exactly the differences are between SERIN/SEROUT and HSERIN/HSEROUT commands? And why would you prefer one over another?
Thanks.
Hi,
Can anyone please tell me what exactly the differences are between SERIN/SEROUT and HSERIN/HSEROUT commands? And why would you prefer one over another?
Thanks.
sorry, I am using Basic Micro 2.2.1.1 programming on mini-ABB, atom28.
The ‘H’ is for hardware. the internal USART peripheral is used with this command.
serin S_OUT,i9600,200000,NoData,[str DualShock(0)\7]
hserin 200000,NoData,[str DualShock(0)\7]
“Hardware” instead of “bit-bang” is normally much faster. In serin you set the baudrate/mode with an “i9600”, with the hardware, you set it with
“sethserial H9600”, and also need to include “ENABLEHSERIAL” ( all quotes mine) up at the top of your code.
serin/out can use most any pin (S_OUT), while Hserin/out must use P14 an P15, as I recall. the BasicAtom module provides the RS-232 level conversion for you (S_OUT), you must provide a MAX232 or similar converter if you use Hserin/out.
serin/out will “block” waiting for the characters it needs, and will “loose” anything that it was not waiting for. Hserin/out can work in the background, doesn’t loose (except for USART overrun) characters, and doesn’t block. It also has commands to check input/output buffer status.
I’m using 5.3.1.3, you might want to upgrade, the older version could be a little different.
Alan KM6VV
so my project is on this particular version, so I cannot upgrade.
so my question is, I have this line of code -->
serin S_IN,i38400,[Xcomponent,Ycomponent]
I need to use HSERIN instead. How will I write it? When you say use P14/15… I know P15 of atom28 I am using is being used to connect to SSC-32. So do I need to change any physical connections?
I am using SEROUT commands to transfer information from atom28 to SSC-32 which works fine, so I don’t want to change those lines. But this one line I gave above, I want to use HSERIN since I feel some data is being lost with SERIN.
ok This is weird - I try to use this code -
[code]sethserial H38400
ENABLEHSERIAL
main
HSERIN [Xcomponent,Ycomponent][/code]
instead of this –
[code]
serin S_IN,i38400,[Xcomponent,Ycomponent]
[/code]
And it gives me that the available RAM on Device exceeded.
What should I do in order to get this to work?
That sounds familiar. I accidentally used a slightly older vers. of the IDE (the program had compiled before on 5.3.1.3), and got that. I was over by 1 byte. It’ll tell you in the “build” window or whatever it’s called.
Another difference between the two serial commands, Hserial stuff uses a bufferer in RAM. That’s probably what kicked you over.
See how much you are over, and see if you can clean up your code and remove an un-wanted variable or two. Go to the the newer IDE might give you a few bytes as well.
Alan KM6VV
That doesn’t make any sense. The code is not likely to need much tweaking if any at all. You don’t want to upgrade to an IDE that is currently supported and insist on using a version that has not seen any changes in 5 or more years? There is no way to really know if you are having a code problem or an IDE problem. To make matters worse you are using the first of two older versions with hardware that has seen changes since 2.2.1.1 was abandoned. No one is likely to install this really old program in order to provide you with help. Might make more sense for you to upgrade to Basic Micro Studio. This would eliminate the IDE guess work for people who are willing to help you.
You’ll have to move the SSC-32, something like pin 8.
Alan KM6VV