Quote Originally Posted by richard View Post
lesson 2

what happens here and why ? does changing the lata initial value make a difference?

Code:
#CONFIG  CONFIG  FOSC = INTIO67
  CONFIG  PLLCFG = OFF
  CONFIG  PRICLKEN = ON
  CONFIG  FCMEN = OFF
  CONFIG  IESO = OFF
  CONFIG  PWRTEN = ON
  CONFIG  BOREN = SBORDIS
  CONFIG  BORV = 190
  CONFIG  WDTEN = ON
  CONFIG  WDTPS = 32768
  CONFIG  CCP2MX = PORTC1
  CONFIG  PBADEN = OFF
  CONFIG  CCP3MX = PORTB5                                
  CONFIG  T3CMX = PORTC0
  CONFIG  HFOFST = ON
  CONFIG  P2BMX = PORTB5
  CONFIG  MCLRE = EXTMCLR
  CONFIG  STVREN = ON
  CONFIG  LVP = OFF
  CONFIG  XINST = OFF
  CONFIG  DEBUG = OFF
  CONFIG  CP0 = OFF
  CONFIG  CP1 = OFF
  CONFIG  CP2 = OFF
  CONFIG  CP3 = OFF
  CONFIG  CPB = OFF
  CONFIG  CPD = OFF
  CONFIG  WRT0 = OFF
  CONFIG  WRT1 = OFF
  CONFIG  WRT2 = OFF
  CONFIG  WRT3 = OFF
  CONFIG  WRTC = OFF
  CONFIG  WRTB = OFF
  CONFIG  WRTD = OFF
  CONFIG  EBTR0 = OFF
  CONFIG  EBTR1 = OFF
  CONFIG  EBTR2 = OFF
  CONFIG  EBTR3 = OFF
  CONFIG  EBTRB = OFF
#ENDCONFIG
'    DEFINE DEBUG_REG PORTB
'    DEFINE DEBUG_BIT 7      ;  if not used for pwr  
'    DEFINE DEBUG_BAUD 9600
'    DEFINE DEBUG_MODE 0  
'  ASM




    ;ANSELA = 0
    DEFINE OSC 64 
    OSCCON = $70
    OSCTUNE.6 = 1
    TRISA = %11111100 
led1 var lata.0
led2 var lata.1


loopy:
lata=3   ;init porta
led2 = !porta.1


led1 = porta.1


pause 3000
 
goto loopy
excuse me starting from lesson 2.

Name:  not porta1.png
Views: 17307
Size:  447.5 KB

First of all as from the configuration, all PORTA is digital with bit 7-2 as input and bit 1-0 to output.

now you have given a number to lata = 3. Even if you change this number nothing happen so far.

LED 2 is opossite state from porta.1

and LED 1 the same state as porta.1

We havent configured any port to high or low. By default the ports are set to low?

Could you also explain what is the logic behind the LATA.