你说的“用新版本烧录BUG太多,以前成熟的产品只要重新编译过就会出错,后面只简单的控制下LED灯的亮灭,从推挽改为双向,再从双向改为推挽,都会出错(灯怎么也不亮了)”吓我一跳,真要是这样,那么我编的程序也要出问题了,我只有8脚的STC8G1K08A和20脚的STC8H1K08,就用STC8H1K08测试,把所有I/O口从推挽改为双向,再从双向改为推挽,让LED亮灭一次,没有发现错误啊,我用的就是stc-isp-v6.90D最新版,无论是仿真还是直接烧片都没有问题,下面是我用到的测试程序,IRC频率仅用1.2M
#include <STC8.h>
void delay ( void ) ;
void main (void)
{
while ( 1 )
{
P1M1 = 0 ; P1M0 = 0xff ; // P1 为推挽输出
P1 = 0xff ;
delay ( ) ;
P1 = 0 ;
delay ( ) ;
P1M1 = 0 ; P1M0 = 0 ; // P1 为准双向口
P1 = 0xff ;
delay ( ) ;
P1 = 0 ;
delay ( ) ;
P1M1 = 0 ; P1M0 = 0xff ; // P1 为推挽输出
P1 = 0xff ;
delay ( ) ;
P1 = 0 ;
delay ( ) ;
P3M1 &= ~0xfc ; P3M0 |= 0xfc ; // P3.2-3.7 为推挽输出
P3 |= 0xfc ;
delay ( ) ;
P3 &= ~0xfc ;
delay ( ) ;
P3M1 &= ~0xfc ; P3M0 &= ~0xfc ; // P3.2-3.7 为准双向口
P3 |= 0xfc ;
delay ( ) ;
P3 &= ~0xfc ;
delay ( ) ;
P3M1 &= ~0xfc ; P3M0 |= 0xfc ; // P3.2-3.7 为推挽输出
P3 |= 0xfc ;
delay ( ) ;
P3 &= ~0xfc ;
delay ( ) ;
P5M1 &= ~0x30 ; P5M0 |= 0x30 ; // P5.4-5.5 为推挽输出
P5 |= 0x30 ;
delay ( ) ;
P5 &= ~0x30 ;
delay ( ) ;
P5M1 &= ~0x30 ; P5M0 &= ~0x30 ; // P5.4-5.5 为准双向口
P5 |= 0x30 ;
delay ( ) ;
P5 &= ~0x30 ;
delay ( ) ;
P5M1 &= ~0x30 ; P5M0 |= 0x30 ; // P5.4-5.5 为推挽输出
P5 |= 0x30 ;
delay ( ) ;
P5 &= ~0x30 ;
delay ( ) ;
}
}
void delay ( void )
{
unsigned char i , j ;
for ( i = 0 ; i < 255 ; i ++ )
{
for ( j = 0 ; j < 255 ; j ++ )
{
}
}
} |