Myke's Home Page

Book CD-ROM Home

File Copying/Harddrive Setup

Development Tools

Experiments

Projects

Useful Code Snippets and Macros

Introduction to Electronics

Introduction to Programming

Datasheets

PCBs

Links

McGraw-Hill Professional Publishing

"LowGoto" Experiment

This experiment demonstrates how inter-page jumps are accomplished in the Low-End PICmicros. Note that the "MyLGoto" macro in "LowGoto" does not change the contents of "w" or "STATUS", so the macro can be considered "General Case".

Note that in the source code below, if you were to check the cycle count at reset, you would find it to be one instead of zero. The reason for this is due to the lack of an instruction at the reset vector address (0x03FF for the PIC16C56). As indicated in the text, the use of address 0 for the reset vector with low-end PICmicro MCU's is common to make the code to appear to behave more like the other PICmicro MCUs and simplify application "porting" between applications. The screen shot shown below shows how the application actually resets in the low-end PICmicro MCU architecture. Low-End PICmicro MCU Reset at last Program Memory Address

The source code is listed below, or it can be accessed from the CD-ROM by clicking Here.

 title  "LowGoto - Low-End Jumping Around."
;
;  In this Application, Jumps Between Device Pages is
;   Demonstrated.  
;
;
;  99.12.25 - Created for the Second Edition
;
;  Myke Predko
;
  LIST P=16C56, R=DEC
  INCLUDE "p16c5x.inc"

;  Registers

;  Macros
MyLGoto MACRO Label
 if ((Label & 0x0200) != 0)
  bsf    STATUS, PA0
 else
  bcf    STATUS, PA0
 endif
 if ((Label & 0x0400) != 0)
  bsf    STATUS, PA1
 else
  bcf    STATUS, PA1
 endif
  goto   Label & 0x01FF		;  Jump to Label Without Page Selections
 endm

 __CONFIG _CP_OFF & _WDT_OFF & _XT_OSC

  PAGE
;  Mainline of LowGoto

 org      0

  goto    Page0Label		;  Goto an Address Within the Same Page


Page0Label			;  Label in Page 0

  MyLGoto Page1Label

 org      0x0200
Page1Label			;  Label in Page 1
  lgoto   Page0Label


  end
              

Click Here to look at the sixth experiment - CondJump