Hi all,
I'm using UART, TX pin1, to output serial data. The oscillator is 16M on the broad. And I output the data by 1M, which I can see the 1M clock on pin4(every rising edge-->a bit output).
uint8_t g_Buffer1[] = {0xAA,0xBB,0xCC};
uint8_t count1 = 0;
void setup() {
Serial.begin(9600); // initialize serial
USART_MSPIM_Init(); // initialize MSPIM mode
SPCR = (1 << SPE); // enable SPI
TIMSK0 = 0; // disable timer0
}
void loop() {
if ((UCSR0A & 32) != 0) { // transmit when data register empty
UDR0 = g_Buffer1[count1]; //transfer code
count++;
}
}
void USART_MSPIM_Init()
{
UBRR0H = 0;
UBRR0L = 0;
DDRD |= _BV (4); // XCK as output enables master mode
UCSR0C = (1 << UMSEL01) | (1 << UMSEL00) | (0 << UCPHA0) | (0 << UCPOL0); // Master SPI, mode 0
UCSR0B = (1 << RXEN0) | (1 << TXEN0); // Enable receiver and transmitter
UBRR0L = 7; // 1MHz XCK on pin 4
}
Is it possible that I can trigger the data output from external 1M signal inputting to the broad?
(The present output rate 1M is what I desired, but the timing is not)
Thanks.