我想我已经把我的 Arduino Micro 冲洗干净了。Tools -> Serial Port
现在,我的 Mac在 Arduino 1.0.5 的菜单中根本看不到串口。
我相信罪魁祸首是我发送给 MCU 的这个命令:
PORTD = B10000000;
更准确地说,这是我尝试发送的程序,之后,我再也看不到 MCU。
关于如何将其恢复为出厂设置的任何建议?
谢谢
#define _V0 6 // V0
#define _V1 7 // V1
#define _SYNC 0x00
#define _BLACK 0x01
#define _GRAY 0x02
#define _WHITE 0x03
#define _tvNbrLines 262 /* Includes the last 20 lines for the vertical sync! */
#define _tvVSyncNbrLines 20 /* These 20 lines... */
#define _ntscDelayHSyncStart 4.7
#define _ntscDelayBackPorch 6 /* Normally 5.9, but this fixes a timing issue */
#define _ntscDelayFrontPorch 1.4
#define _ntscDelayPerLine 51.5
#define _ntscDelayVSync 58.8
#define _tvPixelWidth 21
#define _tvPixelHeight 16
void generateVSync(void);
void writeBufferLine(int position);
void writeTVLines(void);
void clearFrameBuffer(void);
void fillWhiteFrameBuffer(void);
void fillGrayFrameBuffer(void);
void fillPatternFrameBuffer(void);
void loadSprite(void);
byte frameBuffer[_tvPixelWidth][_tvPixelHeight]; // Video frame buffer
void setup()
{
pinMode(_V0, OUTPUT);
pinMode(_V1, OUTPUT);
cli();
}
void loop()
{
// writeTVLines();
writeTest2();
}
void writeTest2(void) {
int i;
PORTD = B10000000; // Make the sync high to start with
for(i=0; i < 5; i++) {
PORTD = B00000000; // Sync pulse goes low and delay 2.3 microseconds
delayMicroseconds(1);
delayMicroseconds(1);
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
PORTD = B10000000; // Sync pulse goes high and delay 29.7 microseconds
delayMicroseconds(29);
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
}
//
// Generate the 5 Field Sync Pulses
//
for(i=0; i < 5; i++) {
PORTD = B00000000; // Sync goes low and delay 27.3 microseconds
delayMicroseconds(27);
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
PORTD = B10000000; // Sync goes high and delay 4.7 microseconds
delayMicroseconds(1);
delayMicroseconds(1);
delayMicroseconds(1);
delayMicroseconds(1);
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
}
//
// Generate 5 Narrow Equalization pulses
//
for(i=0; i < 5; i++) {
PORTD = B00000000; // Sync pulse goes low and delay 2.3 microseconds
delayMicroseconds(1);
delayMicroseconds(1);
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
PORTD = B10000000;
delayMicroseconds(29); // Sync pulse goes high and delay 29.7 microseconds
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
}
// Generate 18 Blank Frames
for(i=0; i < 18; i++) {
PORTD = B00000000; // Pull sync pin low -> 0 volts
delayMicroseconds(4);
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
PORTD = B10000000; // Pull sync pin high
delayMicroseconds(59);
}
//
// Generate half the Image
//
for(i=0; i < 285; i++) {
//
// Front Porch
//
PORTD = B10000000;
delayMicroseconds(1); // Front Porch: 1.65 microseconds
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
//
// Generate sync pulse
//
PORTD = B00000000; // Sync pulse pulled low: 4.7 microseconds
delayMicroseconds(4);
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
//
// Back Porch
//
PORTD = B10000000; // This is the back porch: 5.6 microseconds.
delayMicroseconds(5);
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
//
// Drawing starts here: Total time available is 53 microseconds
//
PORTD = B10000000; // Draw black
delayMicroseconds(20);
PORTD = B11000000; // Draw white
delayMicroseconds(10);
PORTD = B10000000; // Draw black
delayMicroseconds(22);
}
}