Rupert Swarbrick wrote 2013-01-05 16:54: > Hi, > > Can anyone point out what I'm doing wrong with the following (minimal) > code? I can't seem to convince my 16F1824 to output anything on RA5 (pin > 2 in the DIP package). > > I presume that I've configured the pin to be doing something else, but > I've pored over the datasheet for ages and can't work out what I've > missed. Changing the BSF line to "bsf LATA, 4" switches on pin 3 as > expected. Does anyone have any ideas? > > Many thanks, > > Rupert > > > > Assembly file below: > > #include > > ERRORLEVEL -302 ; Banksel warning. > > ; Config options > ; FCMEN 0 (Enables internal oscillator on external death, > ; but we're using internal anyway) > ; IESO 0 (Two-speed start-up. Not used) > ; -CLKOUTEN 1 (Disable CLKOUT and use the pin for IO) > ; BOREN 00 (Disable Brown-out reset) > ; -CPD 1 (Data code protection) > ; -CP 1 (Code protection) > ; MCLRE 1 (Use MCLR pin as MCLR: needs a pull-up resistor!) > ; -PWRTE 1 (Don't enable the power-up timer) > ; WDTE 01 (Watchdog timer software-controlled) > ; FOSC 100 (Internal oscillator) > __config _CONFIG1,b'00100111101100' > > ; LVP 1 (Enable low-voltage programming) > ; -DEBUG 0 (ICSPCLK, ICSPDAT used for debugger) > ; '1' unused > ; BORV 1 (Disabled anyway) > ; STVREN 1 (Stack under/overflow reset) > ; PLLEN 0 (PLL not used) > ; '111111' unused/reserved > ; '11' (Disable write protection) > __config _CONFIG2,b'10111011111111' > > UDATA > > .RST code h'0000' > goto setup > > .ISR code h'0004' > retfie > > setup: > banksel ANSELA > clrf ANSELA > banksel TRISA > clrf TRISA > banksel LATA > clrf LATA > goto main > > main: > clrwdt > > banksel LATA > bsf LATA, 5 > > goto main > > END > > > First, use proper CONFIG directivs including the supplied symbols from the include file. See example in 16F1827TMPO.ASM. Then, how does the code work in MPSIM ? Jan-Erik. --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .