Jump to content

ahkub

Members
  • Content Count

    4
  • Joined

  • Last visited

Community Reputation

0 Neutral

About ahkub

  • Rank
    Newbrie
  1. Hi Andrew, I appreciate your quick answer. For PIC16F877 and C2C compiler, I found a working solution yesterday. (I'll still have to work on BoostC and use your suggestions.) 1. I need to modify the file tinybld16f.asm. original file: radix DEC LIST P=16F876A, F=INHX8M ; change also: Configure->SelectDevice from Mplab xtal EQU 20000000 ; you may also want to change: _HS_OSC _XT_OSC baud EQU 115200 ; standard TinyBld baud rates: 115200 or 19200 ; The above 3 lines can be changed and buid a bootloader for the desired frequency and PIC type _______________________________ my modified file: radix DEC LIST P=16F877, F=INHX8M ; (enter 16F877, not 16F877A) xtal EQU 20000000 ; 20 MHz is what I have baud EQU 115200 ; 115200 is OK for me 1a. Modify tiny PIC bootloader's file in line 26 to 30 replace ___________________________________ IFDEF __16F873A #include "p16f873A.inc" IdTypePIC = 0x32 #define max_flash 0x1000 ENDIF ___________________________________ with ___________________________________ IFDEF __16F877 #include "p16f877.inc" IdTypePIC = 0x32 #define max_flash 0x1000 ENDIF ___________________________________ 2. Next step would be to open MPLAB, change the target to PIC16F877 (not: 877A!), open your modified tinybld16f.asm and project/quickbuild tinybld16f.asm. Then enable your Picstart plus programmer, stick the 16F877 in and press the build button. 3. Now the big step: Using C2C compiler, you need to add the 4 lines to your main file (let's call it MAIN) in order to keep the bootloader working: #pragma RESERVE_ADDR_0 clrf 0x3 #pragma RESERVE_ADDR_1 movlw 0x00 #pragma RESERVE_ADDR_2 movwf 0xA #pragma RESERVE_ADDR_3 goto start__code This code goes right before the following lines: #include "system.h" #pragma CLOCK_FREQ 20000000 4. Compile, debug using C2C compiler. Result: MAIN.asm Then build MAIN.ASM in MPLAB, result will be MAIN.hex 5. Re-insert the PIC, connect the serial cable via Max323 level converter chip to my PC and the PIC, then start tinybldWin.exe on your PC. 6. Browse for "MAIN.hex" and press the Writeflash button 7. Next, as long as TinyPICbootloader is searching for the PIC, quickly connect power to the PIC or reset it. If the settings are OK (Baudrate, COM port), tinybldWin.exe will detect the PIC. It says something like: "PIC16F873A/4A found", although it's an 877. 7a. After downloading, the PIC resets itself and starts with the new program. 8. That's it! After the next change of MAIN, you can loop directly to 4. It WORKS and I can recommend using this bootloader to everybody. It takes away a lot of hassle from PIC programming. (This is for Pic Tiny bootloader, tiny Pic bootloader.) Regards, Hendrik
  2. Hi Hollie, Maybe you could do all of us a big favor and shed some light into the bootloader topic. I was looking for a bootloader that works as universal as possible and support 16F877 and 18F8720. Found it, it's the one you also use: Tiny Pic Bootloader at http://www.ac.ugal.ro/staff/ckiku/software/picbootloader.htm Would you please walk me through the following steps: PIC 16F877 1. I need to modify the file tinybld16f.asm. original file: radix DEC LIST P=16F876A, F=INHX8M ; change also: Configure->SelectDevice from Mplab xtal EQU 20000000 ; you may also want to change: _HS_OSC _XT_OSC baud EQU 115200 ; standard TinyBld baud rates: 115200 or 19200 ; The above 3 lines can be changed and buid a bootloader for the desired frequency and PIC type _______________________________ my modified file: radix DEC LIST P=16F877A, F=INHX8M ; (do I need to adjust the INHX8M?) xtal EQU 20000000 ; 20 MHz is what I have baud EQU 115200 ; 115200 is OK for me Are there any other changes necessary in the tinybld16f.asm file? As far as I understand, I need to build this file for 16F877A, although I use a 16F877. (On the Website it says, Tiny PIC bootloader was reported to work with 16F877.) 2. Next step would be to open MPLAB, change the target to PIC16F877A, open my modified tinybld16f.asm and project/quickbuild tinybld16f.asm. Then I enable my Picstart plus programmer, stick the 16F877 in and press the build button. 3. Now the big step: Using C2C compiler, apparently, we need to add the 4 lines to our main file (let's call it MAIN) in order to keep the bootloader working: #pragma RESERVE_ADDR_0 clrf 0x3 #pragma RESERVE_ADDR_1 movlw 0x00 #pragma RESERVE_ADDR_2 movwf 0xA #pragma RESERVE_ADDR_3 goto start__code Now where exactly does this code go? First lines after the initial remark lines? Right before / after any of these lines (taken from Interface to CompactFlash for PIC16F877 sample on the Picant site)? #include <system.h> #include "serial.h" #include "compactflash.h" #pragma CLOCK_FREQ 20000000 void main() {..... 4. Compile, debug using C2C compiler. Result: MAIN.asm Then build MAIN.ASM in MPLAB, result will be MAIN.hex 5. I re-insert the PIC, connect the serial cable via Max323 level converter chip to my PC and the PIC, then start tinybldWin.exe on my PC. 6. Next, I connect power to the PIC or reset it. If the settings are OK (Baudrate, COM port), tinybldWin.exe should detect the PIC, right? 7. Then I browse for "MAIN.hex" and press the Writeflash button 8. That should be it, right? After the next change of MAIN, I can loop directly to 4, I suppose? So much for 16F877 and C2C compiler. ________________________________________ What about 18F8720 and BoostC? Apparently, as you posted, one will have to make some changes in the source code of Tiny PIC Bootloader, as Andrew (Asmallri) suggests: "What you are describing is a bootloader bug. I have a roll your own bootloader which places the users reset vector contents into high memory. When the bootloader passes control to the application program it jumps to code immediately prior to the users remapped reset vector in high memory. This code resets the page select bits to their reset defaults and then flows into the reset vector code. The users code will then run unmodified which means you do not need to add the "bootloader fixup" you have described. " What exactly would I have to do to implement these changes? Hollie, I would appreciate your help very much. Best regards, Hendrik
  3. Actually, I'm looking for the same thing! I was wondering: Is the internal oscillator exact enough to do 9600 RS232 I/O at all? I appreciate your help! Alf
  4. Hi, I had a bit of trouble using Julian Winpenny's analog.c ADC-to-LCD code but now it works very well. Important: The 4 data lines and the 3 LCD control lines (wr, enable (=sel) and rs) need to be tied to port D. I couldn't find any schematic, so here is the pinning: /* LCD pin 6=E=SEL=PIC Port D bit 3 ( Enables LCD ) */ /* LCD pin 5=WR=PIC Port D bit 2 ( Logic 0 = Write ) */ /* LCD pin 4=RS=PIC Port D bit 1 ( Register select ) */ /* LCD pin 11=Port D BIT 4 */ /* LCD pin 12=Port D BIT 5 */ /* LCD pin 13=Port D BIT 6 */ /* LCD pin 14=Port D BIT 7 */ The voltage to be displayed has to be applied to pin 2=AN0, as far as I remember. Julian sent me his lcd.c and lcd.h files (thanks again!), maybe he could post them on his website, too? Alf
×
×
  • Create New...