1 ; hello.asm -- output 'hello world' to a seven segment display 2 ; the circuit consists of 3 ; 78L05 4 ; PIC12F675 5 ; 74HC164 6 ; 7-segment LED 7 ; seven current limiting resistors 8 ; pins 9 ; pin#7 ( GPIO#0 ) -- connect to both A and B on the '164 10 ; pin#6 ( GPIO#1 ) -- connect to CLK on the '164 11 ; pin#3 ( /MCLR ) -- connect to +5 12 13 ; P12F675.INC Standard Header File, Version 1.04 Microchip Technology, Inc. 14 noexpand 15 16 ; GFEDCBA 17 led_h equ 0b1110110 18 led_e equ 0b1111001 19 led_l equ 0b0111000 20 led_o equ 0b1011100 21 led_bl equ 0b0000000 22 led_w1 equ 0b0111100 23 led_w2 equ 0b0011110 24 led_r equ 0b1010000 25 led_d equ 0b1011110 26 27 ofs equ 0x20 28 temp equ 0x21 29 0000 30 org 0 0000 202e 31 call init 0001 0000 32 nop 0002 0000 33 nop 0003 0000 34 nop 0004 0000 35 nop 36 0005 37 main 0005 0aa0 38 inc [ofs] 0006 0820 39 mov w, [ofs] 0007 200b 40 call get_byte 0008 201d 41 call out_byte 0009 0063 42 sleep 000a 2805 43 jmp main 44 000b 45 get_byte 000b 390f 46 and w, 0x0f 000c 0782 47 add [PCL], w 000d 3476 3479 3438 3438 48 dt led_h, led_e, led_l, led_l, led_o, led_bl, led_w1, led_w2, led_o, led_r, led_l, led_d, led_bl, led_bl, led_bl, led_bl 345c 3400 343c 341e 345c 3450 3438 345e 3400 3400 3400 3400 49 001d 50 out_byte 001d 2024 51 call out_bit 001e 2024 52 call out_bit 001f 2024 53 call out_bit 0020 2024 54 call out_bit 0021 2024 55 call out_bit 0022 2024 56 call out_bit 0023 2024 57 call out_bit 58 ; fall through to out_bit 59 0024 60 out_bit 0024 00a1 61 mov [temp], w 0025 3901 62 and w, 1 0026 0085 63 mov [GPIO], w 0027 3802 64 or w, 2 0028 0085 65 mov [GPIO], w 0029 3901 66 and w, 1 002a 0085 67 mov [GPIO], w 002b 0ca1 68 rrc [temp] 002c 0821 69 mov w, [temp] 002d 0008 70 ret 71 002e 72 init 002e 1283 73 bclr [STATUS], RP0 002f 0185 74 clr [GPIO] ; set values of pins 0030 3007 75 mov w, 7 0031 0099 76 mov [CMCON], w ; turn the comparator off 0032 1683 77 bset [STATUS], RP0 78 ; call 0x3ff 79 ; mov [OSCCAL], w ; calibrate internal oscillator 0033 019f 80 clr [ANSEL] ; set pins to digital io 0034 0185 81 clr [TRISIO] ; set pins to output 0035 1283 82 bclr [STATUS], RP0 ; back to low bank 0036 308f 83 mov w, 0x8f 0037 0081 84 mov [OPTION_REG], w ; disable pullups and set wdt prescalar to x128 0038 0008 85 ret 86 2007 31bc 87 __CONFIG 0x31ff & _CPD_OFF & _CP_OFF & _BODEN_OFF & _PWRTE_OFF & _WDT_ON & _INTRC_OSC_NOCLKOUT