Hi, I was hoping to combine into one sketch, working code for both SPI Dataflash and serial UART IR output.
I was thinking of combining them as a separate function for each process.
So what is currently in setup() will end up in a function within the main loop().
Will I need to reset all the Timer1 registers to wiring IDE defaults before attempting SPI access again?
The CS pin on the Dataflash will still be switching high/low at 38kHz when data transmitted.
Not sure if that is a good idea. The output on pin 10 is not needed.
[code]
//test IR transmission using Arduino pro mini UART
//generates 38kHz carrier wave on pin 9 and 10
//sends data via TX every 500ms
void setup()
{
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
// Clear Timer on Compare Match (CTC) Mode
bitWrite(TCCR1A, WGM10, 0);
bitWrite(TCCR1A, WGM11, 0);
bitWrite(TCCR1B, WGM12, 1);
bitWrite(TCCR1B, WGM13, 0);
// Toggle OC1A and OC1B on Compare Match.
bitWrite(TCCR1A, COM1A0, 1);
bitWrite(TCCR1A, COM1A1, 0);
bitWrite(TCCR1A, COM1B0, 1);
bitWrite(TCCR1A, COM1B1, 0);
// No prescaling
bitWrite(TCCR1B, CS10, 1);
bitWrite(TCCR1B, CS11, 0);
bitWrite(TCCR1B, CS12, 0);
OCR1A = 210;
OCR1B = 210;
Serial.begin(1200);
}
void loop()
{
Serial.write(0);
Serial.write(128);//my data from an array[] will go here
Serial.write(255);
delay(500);
}
[/code]
rxstopend.ino (1.15 KB)
program1test.ino (2.32 KB)