Re: I/O Pin status during startup
Hi, Tumbleweed
the funny thing is I had added the port setting lines right before the TRIS statements for a run With MPLAB 8.92 sim ...
Code:
'****************************************************************'* Name : Led Controller.PBP *
'* Author : Paul Maker *
'* Notice : Copyright (c) 2024 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 19/12/2024 *
'* Version : 1.0 *
'* Notes : 18F2580 *
'* : *
'****************************************************************
'
'
'
;----[18F2580 Hardware Configuration]-------------------------------------------
#IF __PROCESSOR__ = "18F2580"
#DEFINE MCU_FOUND 1
#CONFIG
CONFIG OSC = IRCIO67 ; Internal oscillator block, port function on RA6 and RA7
CONFIG FCMEN = OFF ; Fail-Safe Clock Monitor disabled
CONFIG IESO = OFF ; Oscillator Switchover mode disabled
CONFIG PWRT = OFF ; PWRT disabled
CONFIG BOREN = OFF ; Brown-out Reset disabled in hardware and software
CONFIG BORV = 3 ; VBOR set to 2.1V
CONFIG WDT = ON ; WDT disabled (control is placed on the SWDTEN bit)
CONFIG WDTPS = 512 ; 1:512
CONFIG PBADEN = OFF ; PORTB<4:0> pins are configured as digital I/O on Reset
CONFIG LPT1OSC = OFF ; Timer1 configured for higher power operation
CONFIG MCLRE = OFF ; RE3 input pin enabled; MCLR disabled
CONFIG STVREN = ON ; Stack full/underflow will cause Reset
CONFIG LVP = OFF ; Single-Supply ICSP disabled
CONFIG BBSIZ = 1024 ; 1K words (2K bytes) boot block
CONFIG XINST = OFF ; Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
CONFIG DEBUG = OFF ; Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins
CONFIG CP0 = OFF ; Block 0 (000800-001FFFh) not code-protected
CONFIG CP1 = OFF ; Block 1 (002000-003FFFh) not code-protected
CONFIG CP2 = OFF ; Block 2 (004000-005FFFh) not code-protected
CONFIG CP3 = OFF ; Block 3 (006000-007FFFh) not code-protected
CONFIG CPB = OFF ; Boot block (000000-0007FFh) not code-protected
CONFIG CPD = OFF ; Data EEPROM not code-protected
CONFIG WRT0 = OFF ; Block 0 (000800-001FFFh) not write-protected
CONFIG WRT1 = OFF ; Block 1 (002000-003FFFh) not write-protected
CONFIG WRT2 = OFF ; Block 2 (004000-005FFFh) not write-protected
CONFIG WRT3 = OFF ; Block 3 (006000-007FFFh) not write-protected
CONFIG WRTC = OFF ; Configuration registers (300000-3000FFh) not write-protected
CONFIG WRTB = OFF ; Boot block (000000-0007FFh) not write-protected
CONFIG WRTD = OFF ; Data EEPROM not write-protected
CONFIG EBTR0 = OFF ; Block 0 (000800-001FFFh) not protected from table reads executed in other blocks
CONFIG EBTR1 = OFF ; Block 1 (002000-003FFFh) not protected from table reads executed in other blocks
CONFIG EBTR2 = OFF ; Block 2 (004000-005FFFh) not protected from table reads executed in other blocks
CONFIG EBTR3 = OFF ; Block 3 (006000-007FFFh) not protected from table reads executed in other blocks
CONFIG EBTRB = OFF ; Boot block (000000-0007FFh) not protected from table reads executed in other blocks
#ENDCONFIG
#ENDIF
;----[Verify Configs have been specified for Selected Processor]----------------
; Note: Only include this routine once, after all #CONFIG blocks
#IFNDEF MCU_FOUND
#ERROR "No CONFIGs found for [" + __PROCESSOR__ +"]"
#ENDIF
'*****************************************************************************
OSCCON =110000
OSCTUNE=000000
DEFINE OSC 8
'*****************************************************************************
INCLUDE "ALLDIGITAL.pbp"
DEFINE SHOWDIGITAL 1
'*****************************************************************************
INCLUDE "modedefs.bas"
'DEFINE DEBUGIN_REG PORTB
'DEFINE DEBUGIN_BIT 5
'DEFINE DEBUGIN_BAUD 1200
'DEFINE DEBUGIN_MODE 0
'*****************************************************************************
PORTA = 0
PORTB = 0
PORTC = 0
TRISA = 000000
TRISB = 100000
TRISC = 000000
'*****************************************************************************
'PORTS & PINS
LED1 var PORTC.1 'IC5
LED2 var PORTC.2 'IC5
LED3 var PORTC.0 'IC5
LED4 var PORTA.6 'IC5
LED5 var PORTB.4 'IC5
LED6 var PORTA.7 'IC5
LED7 var PORTB.0 'IC5
LED8 var PORTB.1 'IC5
LED9 var PORTB.2 'IC5
LED10 var PORTB.3 'IC5
LED11 var PORTC.3 'IC5
LED12 var PORTC.4 'IC5
LED13 var PORTC.5 'IC5
LED14 var PORTC.6 'IC5
LED15 var PORTC.7 'IC5
LED16 var PORTA.5 'IC5
LED17 var PORTA.4 'IC5
LED18 var PORTA.3 'IC5
LED19 var PORTA.2 'IC5
LED20 var PORTA.1 'IC5
LED21 var PORTA.0 'IC5
LED22 var PORTB.7 'IC5
LED23 var PORTB.6 'IC5
IC_RX var PORTB.5 'IC5 INPUT
CT VAR BYTE
CT2 VAR BYTE
PA1 VAR WORD
PA2 VAR WORD
PA3 VAR WORD
PA4 VAR WORD
clear
'*****************************************************************************
INIT: ' setting the Variables ... )
PA1=300
PA2=600
PA3=900
PA4=1500
pause 1000
'-----------------------------------------------------------------
START:
high LED3
high LED4
pause 1600
high LED10
high LED15
pause PA4
high LED1
high LED2
high LED6
HIGH LED16
PAUSE 600
PAUSE PA4
'-----------------------------------------------------------------
WHILE 1
high LED9
high LED14
PAUSE PA3
high LED8
high LED13
PAUSE PA3
LOW LED13
PAUSE PA3
HIGH LED7
PAUSE PA3
LOW LED7
HIGH LED13
PAUSE PA3
PAUSE PA3
PAUSE PA3
LOW LED8
PAUSE PA3
LOW LED13
PAUSE PA3
PAUSE PA3
PAUSE PA3
HIGH LED8
HIGH LED13
WEND
With some "cleaning" ( wiped double definitions and "enlighted" the never-ending loop )
MPLAB 8.92 ( the last one ! ) is rather useful for those simple programs debugging using checking breakpoints as it is still working fine with W11 ...
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Bookmarks