With the two new programs in this post, the responsibilities of the two boards are changed, so that they no longer interfere with each other. Basically what both of the two older programs did before, such as different initializations and setting indexes and prototype lines, is now the responsibility of the MSP430. The end result of this is the same test image as with the previous programs. While the MSP430 is running, the Arduino waits in a loop. Once the MSP finishes, it will signal the Arduino by setting the XCS, MOSI and MISO signals to a high output. The Arduino will recognize this and exit the loop. It will then enable the reset for the MSP430, and the Arduino can be used for further operations safely. In its current state, the Arduino program will draw the additional rectangle which can be seen at the bottom of the image.
As usual, the camera causes effects that would not be visible to human eye.
The only changes to the MSP430 program are the three lines below, which have been added to the end of ntsc.c. These work as a signal to Arduino.
Code: Select all
USICTL0 |= USISWRST; // Disable the USI module (used for SPI) with software reset
P1OUT |= 0xB << 4; // XCS, MOSI and MISO to output mode
P1DIR |= 0xB << 4; // Set the outputs high
Code: Select all
void setup() {
Serial.begin(9600);
Serial.print("\n\n");
// MSP430 reset disabled
pinMode(8, OUTPUT);
digitalWrite(8, HIGH);
// VS23 reset disabled
pinMode(9, OUTPUT);
digitalWrite(9, HIGH);
delay(10);
// Set XCS, MOSI, MISO and SCLK to input mode
pinMode(10, INPUT);
pinMode(11, INPUT);
pinMode(12, INPUT);
// Wait until the pins are all high
while ( !( digitalRead(10) &&
digitalRead(11) &&
digitalRead(12) ) );
// Enable MSP430 reset
pinMode(8, OUTPUT);
digitalWrite(8, LOW);
SpiRamVideoInit();
}
void loop() {
// put your main code here, to run repeatedly:
}
Code: Select all
void SpiRamVideoInit() {
// Initialize SPI and and check the VS23 ID
SpiRamInit();
FilledRectangle(144, 165, 176, 195, 165);
Serial.print("Current line: 0x");
Serial.println(SpiRW(CURLINE, 0, 0, 1), HEX);
}