PIC10F200 >> Assembly
3根GPIO驅動6顆LED
main.s
list p=10f200, r=hex #include <p10f200.inc> __config _CONFIG, _IntRC_OSC & _WDTE_OFF & _MCLRE_OFF org 0x00 start: movlw b'11000000' option loop: call led0 call led1 call led2 call led3 call led4 call led5 goto loop led0: movlw b'00001100' tris GPIO bsf GPIO, 0 bcf GPIO, 1 return led1: movlw b'00001100' tris GPIO bcf GPIO, 0 bsf GPIO, 1 return led2: movlw b'00001010' tris GPIO bsf GPIO, 0 bcf GPIO, 2 return led3: movlw b'00001001' tris GPIO bsf GPIO, 1 bcf GPIO, 2 return led4: movlw b'00001001' tris GPIO bcf GPIO, 1 bsf GPIO, 2 return led5: movlw b'00001010' tris GPIO bcf GPIO, 0 bsf GPIO, 2 return end
編譯
$ gpasm main.s
完成