I need to develop an industrial application that has to drive RA6 and RA7 as output pins.
Datasheet:
Table 9-3:
PIN_____________Func___TRIS___I/O___I/O Type___Description
OSC2/CLKO/RA6__OSC2____x_____O_____ANA_____Main oscillator feedback output connection (HS mode).
________________CLKO____x_____O_____DIG______System cycle clock output (FOSC/4) in RC and EC Oscillator modes.
________________RA6_____1_____I_____TTL______PORTA<6> data input.
________________________0_____O_____DIG______LATA<6> data output.
OSC1/CLKI/RA7___OSC1_____1_____I_____ANA_____Main oscillator input connection.
________________CLKI_____1_____I_____ANA_____Main clock input connection.
________________RA7_____1_____I_____TTL_____PORTA<6> data input.
________________________0_____O_____DIG_____LATA<6> data output.
This should correspond in boostc with:
trisa.6 = 0; //configure pin RA6 as output
trisa.7 = 0; //configure pin RA7 as output
/* and */
lata.6 = 0; //send false to RA6
lata.7 = 0; //send false to RA7
/* or */
lata.6 = 1; //send true to RA6
lata.7 = 1; //send true to RA7
and should be the same as with using OUT in Flowcode.
My osc configuration is INTOSCPLL that as per datasheet:
REGISTER 25-3: CONFIG2L: CONFIGURATION REGISTER 2 LOW (BYTE ADDRESS 300002h)
010 = INTOSCPLL, internal oscillator with PLL software controlled, port function on RA6 and RA7
My CONFIG2L word is: %01010010
The problem is that:
1. If I enable RA6 and send true, the port will later stay in true forever.
2. If I enable RA7 and send true, nothing will happen
Flowcode version is 5.5.2.1
I might be missing something obvious ... I am sorry to bother you all, but maybe someone can push me on the right path.
Thank you.
PIC18F46J11-I/PT PORTA RA6 RA7 problem
Moderator: Benj
-
- Posts: 14
- Joined: Sat Apr 14, 2012 11:37 pm
- Location: Iasi, Romania
- Has thanked: 8 times
- Been thanked: 7 times
PIC18F46J11-I/PT PORTA RA6 RA7 problem
- Attachments
-
- LOP_TESTER_PIC18F46J11_I_PT.fcf
- (7.5 KiB) Downloaded 409 times
-
- Posts: 14
- Joined: Sat Apr 14, 2012 11:37 pm
- Location: Iasi, Romania
- Has thanked: 8 times
- Been thanked: 7 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: PIC18F46J11-I/PT PORTA RA6 RA7 problem
Hello,
With BoostC I don't think this syntax will work.
trisa.6 = 0; //configure pin RA6 as output
trisa.7 = 0; //configure pin RA7 as output
lata.6 = 0; //send false to RA6
lata.7 = 0; //send false to RA7
lata.6 = 1; //send true to RA6
lata.7 = 1; //send true to RA7
Instead you could use syntax like this.
clear_bit(trisa, 6);
clear_bit(lata, 6);
set_bit(lata, 6);
Or you could use a Flowcode calculation icon rather than C code.
$PORTA.6 = 0
$PORTA.6 = 1
With BoostC I don't think this syntax will work.
trisa.6 = 0; //configure pin RA6 as output
trisa.7 = 0; //configure pin RA7 as output
lata.6 = 0; //send false to RA6
lata.7 = 0; //send false to RA7
lata.6 = 1; //send true to RA6
lata.7 = 1; //send true to RA7
Instead you could use syntax like this.
clear_bit(trisa, 6);
clear_bit(lata, 6);
set_bit(lata, 6);
Or you could use a Flowcode calculation icon rather than C code.
$PORTA.6 = 0
$PORTA.6 = 1
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel