I am seeing a very strange thing in this very simple code (PBP v 2.6C) when I try to run it on my EASYPIC6. The EASYPIC6 has built in LEDs for every Port output. I have two that are blinking on PortB but the one that is coded the very same way on PortC will not blink. Can anyone tell me why?
I also don't understand why the FineLine Editor automatically bolds the PORTC alias but not the PORTB aliases??
Code:
'< FL_PIC18F4550 >' ' First valid PIC found within the first 200 lines will
' highlight AND set device.
'***********************************************************************
'* Name : BLINKY_EASYPIC6.pbp *
'* Author : John R. Ellis *
'* Notes : 1) This code was designed/devloped on an EasyPic6 *
'* Compiler: PICBASIC PRO Compiler 2.60C from microEngineering Labs *
'* Device : 18F4550 *
'* Memory : 188 bytes of Program Memory required. *
'***********************************************************************
' -----------------------[ Program Description ]------------------------
' PICBASIC PRO program to blink LED on EASYPIC6 *
''**********************************************************************'-----------------18F2550/4550 Port/PIN Connections ]-------------------
'I/O pin connections to the 18F4550 MCU are as follows:
'PORTC.4 (15) connected as RED_LED
'PORTC.5 (16) connected as GRN_LED
'INCLUDE "CodeSize.pbp" 'FOR TEST ONLY
DEFINE Measure 1
;@ StartSize(LOOKUP) 'FOR TEST ONLY
INCLUDE "18F2550_4550_CONFIGS.pbp" ' Setup CONFIGS for MCU
'--------------[ Define Hardware / Set Registers ]------------------------
DEFINE OSC 16 ' Using 8 MHz crystal
Include "Modedefs.Bas" ' Mode definitions for Debug,Serin/out,
' Shiftin/out, Xin/out.
INCLUDE "ALLDIGITAL.pbp" ' Sets all registers for digital ops.
' User must make sure AllDigital.pbp file
' is in same or higher directory location as
' this source code before compiling.
'DEFINE SHOWDIGITAL 1 ' When uncommented will show analog settings
' in Assembler Results window.
TRISA = 0 ' PortA reserved as output connections to LCD interface
TRISB = %00001100 ' RB2 & RB3 reserved as RTC Alarm1 & Alarm2 inputs
' PORTB.2 is also an input from switch grounding
' PortB.4 is used for LED_RED
' PortB.5 is used for tthe GRN_LED
TRISC = 0 ' PortC is all Outputs
CLEAR
'--- Variables -----------------------------------------------------------
LED_RED VAR PORTB.4 ' Red LED
LED_GRN VAR PORTB.5 ' Green LED used to indicate Routine entries
LED_EASYPIC VAR PortC.5
'Setup for starting Main Program
'Initialize LEDs to off
LOW LED_GRN
LOW LED_RED
LOW LED_EASYPIC
'--------------------[ Begin Main Program Loop ]-------------------------
;@ StartSize(MainLoop) ; FOR TEST ONLY
mainloop:
' Blink LEDs
PAUSE 5000
HIGH LED_GRN
HIGH LED_RED
HIGH LED_EASYPIC
PAUSE 1000
LOW LED_GRN
LOW LED_RED
LOW LED_EASYPIC
WRITE 255,9 'Write to EEPROM as Test if executing to this location
GOTO mainloop
;@ EndSize(MainLoop) ; Uncomment FOR TEST ONLY
End ' Safety measure to insure program stops if reaches here
Bookmarks