程序如下,变量为count,在MOVLW 10 MOVWF
count,0 这两个个语句中变量没有被赋值
#include
extern int count;
void main()
{
int count=8;
_asm
MOVLW 10
MOVWF count,0
MOVLW 0xF8 /*设RC0-RC2输出*/
MOVWF TRISC,0
nop
MOVLW 0x00 /*CCD脉冲头段开始*/
MOVWF PORTC,0
nop
MOVLW 0x03
MOVWF PORTC,0
nop
BCF PORTC,0,0
nop
nop
DECF PORTC,1,0
nop
nop
DECF PORTC,1,0
nop
nop
MOVLW 0x07
MOVWF PORTC,0
nop
DECF PORTC,1,0
nop
nop /*以上为CCD脉冲头段*/
done:
MOVLW 0x01 /*CCD主脉冲第一段2周期开始*/
MOVWF PORTC,0
BCF PORTC,0,0
nop
nop
MOVLW 0x03
MOVWF PORTC,0
nop
DECF PORTC,1,0
nop
nop /*CCD主脉冲第一段2周期结束*/
DECF PORTC,1,0 /*CCD主脉冲第二段2周期开始*/
nop
nop
DECF PORTC,1,0
nop
nop
MOVLW 0x03
MOVWF PORTC,0
nop
DECF PORTC,1,0
nop
nop /*CCD主脉冲第二段2周期结束*/
DECF PORTC,1,0 /*CCD主脉冲第三周期开始*/
nop
nop
DECF PORTC,1,0
nop
nop /*CCD主脉冲第三周期结束*/
DECFSZ count, 1,0
GOTO done
nop
_endasm
}
本帖最后由 laoqi 于 2015-3-31 21:34 编辑