我想我已经把我的Arduino Micro冲干净了。现在,我的苹果电脑在Arduino 1.0.5的Tools -> Serial Port菜单中根本看不到串口。
我相信罪魁祸首是我发给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);
}
}发布于 2013-09-16 02:44:13
我能够解决这个问题。
对于那些想知道的人,我所做的是:
1)已将Arduino插入不同的USB端口。
2)注意到现在列出了串行端口。
3)快速上传了一个非常简单的程序。
现在一切都好了。我花了几次尝试重置Arduino并按下CTRL + U,才找到了正确的时机。
https://stackoverflow.com/questions/18815002
复制相似问题