unsigned char m1='1'; unsigned char m2='2'; unsigned char m3='3'; int main (void) { volatile unsigned int i; UARTBuffer[0]=m1; UARTBuffer[1]=m2; UARTBuffer[2]=m3; UARTInit(9600); while (1) { [COLOR=Red] for(i=0;i<1E5;i++){} //delay[/COLOR] UARTSend( (uint8_t *)UARTBuffer, 3); UARTBuffer[2]=++m3; } } |
SysTick->LOAD=SystemCoreClock; |
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]#include [/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"driver_config.h"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#2a00ff] [LEFT][/COLOR][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]#include[/LEFT] [/LEFT] [/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"target_config.h"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#2a00ff] [LEFT][/COLOR][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]#include[/LEFT] [/LEFT] [/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"gpio.h"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#2a00ff] [LEFT][/COLOR][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]#include[/LEFT] [/LEFT] [/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]<stdio.h>[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#2a00ff] [LEFT][/COLOR][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]#include[/LEFT] [/LEFT] [/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"uart.h"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#2a00ff] [/COLOR][/SIZE] [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]int[/LEFT] [/LEFT] [/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2]state=0;[/SIZE] [LEFT][SIZE=2][COLOR=#005032][SIZE=2][COLOR=#005032]uint8_t[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] UARTBuffer[BUFSIZE];[/SIZE] [SIZE=2][COLOR=#005032][SIZE=2][COLOR=#005032]uint32_t[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] count=3;[/SIZE][/LEFT] [LEFT][SIZE=2] [/SIZE] [B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/LEFT] [/LEFT] [/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2][B]SysTick_Handler[/B] ([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2])[/SIZE] [LEFT][SIZE=2]{[/SIZE] [SIZE=2]state=~state;[/SIZE] [SIZE=2]GPIOSetValue( 0, 7, state);[/SIZE][/LEFT] [LEFT][SIZE=2]UARTBuffer[0]=80;[/SIZE] [SIZE=2]UARTBuffer[1]=81;[/SIZE] [SIZE=2]UARTBuffer[2]=82;[/SIZE][/LEFT] [LEFT][SIZE=2]UARTSend( ([/SIZE][SIZE=2][COLOR=#005032][SIZE=2][COLOR=#005032]uint8_t[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] *)UARTBuffer, count );[/SIZE][/LEFT] [LEFT][SIZE=2]}[/SIZE] [B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]int[/LEFT] [/LEFT] [/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2][B]main[/B] ([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2])[/SIZE] [LEFT][SIZE=2]{[/SIZE] [SIZE=2]SystemInit ();[/SIZE] [SIZE=2]GPIOInit();[/SIZE][/LEFT] [LEFT][SIZE=2]UARTInit(115200);[/SIZE][/LEFT] [LEFT][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]/*[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f5f] [SIZE=2][COLOR=#3f7f5f]1 - output[/COLOR][/SIZE] [SIZE=2][COLOR=#3f7f5f]0 - input[/COLOR][/SIZE] [SIZE=2][COLOR=#3f7f5f]*/[/COLOR][/SIZE] [/COLOR][/SIZE][SIZE=2]GPIOSetDir(0,7,1);[/SIZE][/LEFT] [LEFT][SIZE=2]SysTick->[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]LOAD[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=SystemCoreClock;[/SIZE] [SIZE=2]SysTick->[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]VAL[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=0;[/SIZE] [SIZE=2]SysTick->[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]CTRL[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=0x7;[/SIZE][/LEFT] [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]while[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] (1) {}[/SIZE][/LEFT] [LEFT][SIZE=2]}[/SIZE][/LEFT] I am using digitus serial converter. 2 pin RX to LPC11C24 board TX (P1_7) 3 pin TX to LPC11C24 board RX (P1_6) 5 pin gnd to board gnd |