Menu

how do I change the start location in code

Help
2007-11-24
2013-05-30
  • Joshua Wojnas

    Joshua Wojnas - 2007-11-24

    I am using a bootloader that jumps to 0x800 I think ...
    so how do I change the start location in assembly it might be ORG in my GCB code?

     
    • Joshua Wojnas

      Joshua Wojnas - 2007-11-27

      so how do i tell it go their

       
    • Nobody/Anonymous

      Your code template should look like this:

      'blink led test

      #chip 16F877a, 10
      #option bootloader

      goto main

      asm org 0x0800

      'start of main loop
      main:

      ' your code
      goto main   

      Compile this and look at the assembly code. You will see

      #include <P16F877A.inc>
      __CONFIG _HS_OSC & _WDT_OFF & _LVP_OFF

      ;********************************************************************************

      ;Jump to initialisation code when PIC is reset
          ORG    0
          clrf    PCLATH
          goto    SystemInitialise

      ;********************************************************************************

      ;Interrupt vector
          ORG    4
          retfie

      ;********************************************************************************

      ;Various initialisation routines, automatically called by GCBASIC
      SystemInitialise
          call    INITSYS

      ;********************************************************************************

      ;Start of the main program
          goto    MAIN
          ORG    0X0800
      MAIN
          goto    MAIN
      BASPROGRAMEND
          sleep
          goto    $

      Do not forget the "goto main" before the "asm org 0x0800"

      Question: What bootloader are you using? I would like to take a look at it.

       
    • Retlif Wen

      Retlif Wen - 2008-03-03

      I dun quite understand this. I have a PIC18F25550 UBS Bit Wacker from SparkFun. They have a UBW bootloader. If I want to retain the bootloader in the PIC and still be able to add program into the PIC ( like if I push a button, I will jump to my program. Else, it will be in the bootloader default program ).

      How do I achieve this functionality.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.