Embedded






Embedded Technology
SERCOM
SERCOM has proven to be a very good alternative for STDIO when programming controllers like 89c1051/2051, which puts a lost of emphasis on CODE size.
Functions :
Name
 Parameters 
 Return 
 Example
 Remarks 
serial_ini BAUD, Fosc(MHz) void serial_ini( 19200, 11.0592 ); macro for initializing com port
para : 8 bits, 1 Stop bit, using Tmr1
sendstr char * void sendstr( "To test SERCOM" ); sends a string via com port
senduchar UBYTE void senduchar( 23 ); sends an unsigned short int
sendch char void sendch( '#' ); sends a single character
waitstr char * void char name[20];
waitstr( name );
waits for string terminated by CR or 
LF character
waituchar UBYTE * void uchar i;
waituchar( &i );
waits for an unsigned short int termin
-ated by a CR or LF character
waitch void char char ch;
ch = waitch( );
waits for a single character

Code & Time efficiency :
SERCOM library functions produce smaller CODE sizes and also execute at faster rates.
 
SERCOM
STDIO
SAMPLE
PROGRAM
#include <reg51.h>
#include <sercom.h>

void main( )
{
data char i = 34;
serial_ini (19200,11.0592);
sendstr ("\nThis is the value of i :");
senduchar ( i );
while(1);
}

#include <reg51.h>
#include <stdio.h>

void main( )
{
data char i = 34;
PCON |= 0x80;  /* 19200 Baud setting */
TH1 = 0xFA;
printf ( "\nThis is the value of i :%d", i );
while(1);
}

CODE SIZE 532 Bytes 843 Bytes
EXEC. TIME 2.464237 ms 4.615968 ms

note : For ease of operation sercom.obj was included in the C51s.lib file of the Franklin's C 
( ProView 32) & the sercom.h was put under the inc folder. SERCOM works well with the Franklin's ProView, In case you are using any other compiler and you find that you are not able to link with the Object file (sercom.obj), Please mail me at MichaelAnburaj@hotmail.com


Download Sercom.zip

 

 
Micro controller Embedded Technology Real time O S CowBull Game
About me Feedback Links Home

 
All materials in this Web page are as per the author's understanding & perception. So if you find any aspect contradicting with that of others, please do detail it to the author : MichaelAnburaj@hotmail.com. This will help in perfecting the technical reach.

All rights reserved.
Contacts: Michael Anburaj

Hosting by WebRing.