void main(void){ unsigned short phrase = 0; unsigned char data[50]; unsigned short check = 0; unsigned short length = 0; int i = 0; SCIb_Init(9600); DDRP |= 0x80; //Port P bit 7 is output to LED PLL_Init(); //Running at 24 MHz SCI1_Init(115200); // fastest standard baud rate on run mode 9S12DP512 XBee_Init(); asm cli SCI1_OutString("XBee Test"); OutCRLF(); for(;;){ SCI1_OutString("XBee Output: "); XBee_ReceiveRxFrame(data); SCI1_OutString(data);OutCRLF(); } }
void FlightState0() { // init peripherals LED_Init(); USART_Comms_Init(); init_M56511(); Hotwire_Init(); Buzzer_Init(); for( int i = 0; i < 100; i++) { ms5611_altitude(); } // after sampling many times, we store initAltitude initAltitude = telemetry.altitude_f; // start these up here so we don't broadcast garbage while sampling init_MS5611_callback(); XBee_Init(); // check timestamps here #ifdef TIMING_DEBUG while(true) { printf("\t\n"); delay_ms(1000); } #endif #ifndef FS_DEBUG while((telemetry.altitude_f - initAltitude) < LAUNCH_DETECT) { delay_ms(1); } #endif }
//---------------------mainRx--------------------- // main used for receiver // Input: none // Output: none void main(void) { PLL_Init(); SCIb_Init(9600); XBee_Init(); LCD_Open(); LCD_Clear(); LCD_OutString("Xbee: "); EnableInterrupts; while(1) { // Rx DP512 continually polls the Rx FIFO and any available data is // displayed on the LCD using the LCD driver routines. XBee_ReceiveRxFrame(&rxFrame[0]); /*if(SCIb_InStatus() && (rxFrame != 0)) { unsigned short messageLength = ((rxFrame[1]<<8) + rxFrame[2])-5;//message length only unsigned short i; for(i = 0; i < messageLength; i++){ LCD_OutChar(rxFrame[i+8]); } printf("\n"); }*/ LCD_GoTo(1,1); LCD_OutString(&rxFrame[0]); } }