Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
If you're using 16F PICs then you want the Mid-Range Manual. It goes into much better detail on everything than the datasheets. In fact, for some PICs the datasheets miss things that the MRM covers properly.Any 1 no where you can down load pic assembly Instruction set that go into more details than the data sheet.
PICmicro® 18C MCU Family
Reference Manual
https://www.electro-tech-online.com/custompdfs/2008/12/39500a.pdf
I would think this would be the best source. Who knows better than Microchip?
One example is the Eeprom write routines where they don't clear the CFGS bit. Works fine in the simulator but in real life you end up writing to your config bits rather than eeprom/data memory.
Oh and speaking of mistakes .....
On friday after spending most of the day testing stuff to be posted out this week, I had a spare hour to have a play with one of the new products I'm designing.
I'd been working on some serial code for a while in MPLAB and it all seemed to be working fine. I thought I'd bung it on one of the processors and give it a test in real life.
Plugged the 18F1320 into the breadboard, powered it up and got garbage on the RS232 terminal. Then it reset itself and repeated this.
I then remembered to put the 0.1uf bypass cap across the power pins and the resets stopped. It worked as it should but the characters I was expecting were not appearing on the terminal.
I then tried different baud rates on the terminal, a different Serial port, a couple of USB-RS232 adapters and still got the same results.
Double checked the code - it all seemed fine.
Turns out I had a 4Mhz crystal on the circuit rather than the 10Mhz one I thought I was using. With HSPLL enabled, this meant I was running at 16Mhz rather than 40Mhz.
Sometimes its the simplest of things that throws you.
bsf STATUS,RP0 ; select Register Page 1
banksel TRISB ;Since this register is in bank 1,
;not default bank 0, banksel is
;used to ensure bank bits are correct.
Quote from Nigel GoodwinBanksel produces two lines, like the example below, as long as you know what bank you're already in you don't need to use both lines - so it's slightly less efficient.
Code:
BSF STATUS , RP0
BCF STATUS , RP1
MOVLW 0x06
MOVWF ADCON1
BCF STATUS , RP0
BCF STATUS , RP1
Oh. Why didn't you say so? Sounds like you want the MPASM manual.What I'm looking for I ran into it on the net but can't find it now. It told how to use the 35 Instruction with a piece of code to show you to. like this
and that it means bit set fCode:bsf STATUS,RP0 ; select Register Page 1
I have seen it same thing done with banksel
And it a directiveCode:banksel TRISB ;Since this register is in bank 1, ;not default bank 0, banksel is ;used to ensure bank bits are correct.
It's part of mplab MPASM assemblerBanksel isn't an instruction/opcode though