The problem of how to work with ports

General discussion on mikroBasic PRO for dsPIC30/33 and PIC24.
Post Reply
Author
Message
ateabe
Posts: 11
Joined: 18 Feb 2013 12:53

The problem of how to work with ports

#1 Post by ateabe » 06 Apr 2013 08:10

I work with the ports and pins and configure the software can not find it in the help.

For example, the

program Led_Blinking

main:
' PLL settings
PLLPRE_4_bit = 0 ' PLLPRE<4:0> = 0 -> N1 = 2 8MHz / 2 = 4MHz
PLLPRE_3_bit = 0 ' (must be within 0.8 MHz to 8 MHz range)
PLLPRE_2_bit = 0
PLLPRE_1_bit = 0
PLLPRE_0_bit = 0

PLLFBD = 38 ' PLLDIV<8:0> = 38 -> M = 40 4MHz * 40 = 160MHz
' (must be within 100 MHz to 200 MHz range)

PLLPOST_0_bit = 0 ' PLLPOST<1:0> = 0 -> N2 = 2 160MHz / 2 = 80MHz
PLLPOST_0_bit = 0 ' (must be within 12.5 MHz to 80 MHz range)

AD1PCFGL = 0xFFFF ' Set All pins as digital
AD1PCFGH = 0xFFFF

TRISA = 0 ' Initialize PORTA as output
TRISB = 0 ' Initialize PORTB as output
TRISC = 0 ' Initialize PORTC as output
TRISD = 0 ' Initialize PORTD as output
TRISF = 0 ' Initialize PORTE as output
TRISG = 0 ' Initialize PORTG as output

LATA = 0 ' Set PORTA to zero
LATB = 0 ' Set PORTB to zero
LATC = 0 ' Set PORTC to zero
LATD = 0 ' Set PORTD to zero
LATF = 0 ' Set PORTE to zero
LATG = 0 ' Set PORTG to zero

while TRUE
LATA = not LATA ' Invert PORTA value
LATB = not LATB ' Invert PORTB value
LATC = not LATC ' Invert PORTC value
LATD = not LATD ' Invert PORTD value
LATF = not LATF ' Invert PORTE value
LATG = not LATG ' Invert PORTG value
Delay_ms(1000)
wend
end.

Please help so I can find them.

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: The problem of how to work with ports

#2 Post by filip » 08 Apr 2013 12:30

Hi,

If you are referring to the LAT, TRIS, PORT and other registers/bits in your code, you should consult the datasheet of the microcontroller used,
as they are microcontroller specific information, not compiler specific.

Regards,
Filip.

ateabe
Posts: 11
Joined: 18 Feb 2013 12:53

Re: The problem of how to work with ports

#3 Post by ateabe » 09 Apr 2013 07:48

thanks filip.

Post Reply

Return to “mikroBasic PRO for dsPIC30/33 and PIC24 General”