2007-10-10 11:30 PM
2007-09-30 11:36 PM
/***********************************************************************/
Hello Sagai, This is an example: ---------------------- /* */ /* SERIAL2 */ // Initialize the Asynchronous Serial Communication interface ASC0 to // transmit a string at 9600 Baud, 8 Data and 1 Stopbit no Parity // // Use an interrupt to load the ASC0 Transmit Buffer Register // Use your system terminal program to display the message. /***********************************************************************/ #include /********************************************************************/ sfrbit DP20 _atbit(DP2,0); sfrbit DP21 _atbit(DP2,1); sfrbit DP22 _atbit(DP2,2); sfrbit DP23 _atbit(DP2,3); sfrbit DP310 _atbit(DP3,10); sfrbit P310 _atbit(P3,10); /********************************************************************/ void init_sci_ch0( void ); void delay( void ); /********************************************************************/ #pragma global static volatile char msg[] = { ''Hello World, this is ST10F276 but soon it will be ST10F29x'' }; /********************************************************************/ void init_sci_ch0( void ) { /* Port P3.10 = Serial Output, the TX pin */ /* first set port, before changing the direction (avoid glitch) */ _putbit (1, P3, 10); DP310 = 0x01; /* Asynchron mode, transmission only, no Error Checks */ S0CON = 0x0001; /* 9600 baud the CPU clock frequency is 40MHz */ S0BG = 0x81; /* Transmit Interrupt, ILVL=8, GLVL=0 */ S0TIC = 0x60; /* Baud Rate Generator Start */ S0R = 1; } /********************************************************************/ // Serial transmit interrupt service routine interrupt( 0x2A ) void s0_tx_int( void ) { static volatile char *cptr; static volatile char n=0; static volatile char m=0; if( n==0 ) cptr = msg; m = *cptr; if( m != '\0' ) { S0TBUF = m; cptr++; } else { n = 0; return; } n++; /* LEDs Games */ if(P2++ > 4) { delay(); P2 = 4; } } /********************************************************************/ void delay( void ) { volatile unsigned int t1, t2, t3=0; for( t1= 15000; t1 > 0; t1-- ) { for( t2=0xffff; t2>0; t2++ ) t3++; } } /********************************************************************/ main() { volatile unsigned int p=0; /* P2.0 - 2.3 = output */ DP20 = DP21 = DP22 = DP23 = 0x01; /* LEDs = OFF */ P2 = 0xFF; delay(); // init ASC0 init_sci_ch0(); /* Global Interrupt Enable */ IEN = 1; /* Trigger Serial Transmission */ S0TIR = 1; while( 1 ) { /* LEDs Games */ if(P2++ > 4) { delay(); P2 = 1; } delay(); /* Repeat Transmission after delay */ if( p++ > 50 ) { S0TIR=01; p=0; } } } /********************************************************************/ Regards, Najoua.2007-10-03 12:13 AM
Hello Sir,
Thank you sir for your reply. If want to change application from the ST10F269 to the ST10F276 and use only IFLASH , Is posible? Do I need to initialize any other registers? Could please help me on this? Thanks and Best Regards, sagi2007-10-10 11:30 PM
Hello Sagai,
Yes, it is possible to port your application from the ST10F269 to the ST10F276. Please have a look to the AN2555 'porting an application from the ST10F269 to the ST10F276' available on the following link: Best regards, Najoua.