我想我已经收拾了Arduino Micro。现在,我的Mac在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);
}
}
答案 0 :(得分:2)
我能够解决它。
对于那些想知道的人,我做的是:
1)将Arduino插入另一个USB端口。
2)注意到现在列出了串口。
3)快速上传了一个非常简单的程序。
一切都很顺利。我花了几次尝试重置Arduino并按下CTRL + U
然后才把时机调到正确的位置。