added a couple C examples

This commit is contained in:
Fernando 2025-03-24 22:25:53 -06:00
parent 47d91da1fa
commit 47b0b509dc
3 changed files with 14 additions and 11 deletions

0
.gitignore vendored Normal file → Executable file
View File

View File

@ -8,23 +8,26 @@ CONFIG LVP = OFF ; Low-Voltage Programming off
CONFIG MCLRE = OFF ; MCLR pin disabled, RE3 input enabled CONFIG MCLRE = OFF ; MCLR pin disabled, RE3 input enabled
R1 EQU 0x020 R1 EQU 0x020
R2 EQU 0x021 R2 EQU 0x021
TEMP EQU 0x22
ORG 0x00 ; Program starts at address 0 ORG 0x00 ; Program starts at address 0
Start: Start:
; Initialize PORTB ; Initialize PORTB
CLRF TRISD ; Set all PORTB pins as output CLRF TRISD ; Set all PORTB pins as output
CLRF LATD ; Clear PORTB outputs CLRF LATD ; Clear PORTB outputs
CLRF LATB
BCF INTCON2, 7 BCF INTCON2, 7
movlw 0fh ; Set all pins to digital I/0 MOVLW 0fh ; Set all pins to digital I/0
movwf ADCON1 MOVWF ADCON1
MOVLW 0xFF MOVLW 0xF0
MOVWF TRISB MOVWF TRISB
CLRF LATB
;MOVLW 0x0E
;MOVWF PORTB
loop: ; Read first nibble of port D and print it to the second nibble
MOVFF PORTB, PORTD
loop:
movff PORTB, PORTD
goto loop
END ; End of program END ; End of program

View File

@ -1,6 +1,6 @@
:020000040000FA :020000040000FA
:10000000956A8C6A8A6AF19E0F0EC16EFF0E936E1E :10000000956A8C6AF19E0F0EC16EF00E936E8A6A2D
:0800100081CF83FF08EF00F02F :0400100081CF83FF1A
:020000040030CA :020000040030CA
:04000000000C1F1EB3 :04000000000C1F1EB3
:02000500038175 :02000500038175