Questions regarding ports on PIC-WEB

Started by gg3390, July 11, 2016, 03:12:13 PM

Previous topic - Next topic

gg3390

Hi,
Could anybody let me know if all ports on the expansion connection EXT are available for use as GPIO pins. I'm using the PIC-WEB board to monitor approx 15 DS18B20 sensors, in a sequential fashion, with one sensor on each pin.
The majority of the sensors work fine (the code for reading them is common to all ports), but some pins refuse to give any results, for example RF1, RF2 and RB5.
As I said the code for those pins is the same as the code for working pins such as RB4 - only difference is the number.

I guess I'm missing a register configuration somewhere, but I cannot see where.
Ive tried various combinations of ADCON1 settings and CMCON to disable the comparators, but still no joy.
It's a PIC-WEB revision C board, and any help or points in the right direction would be greatly appreciated.
Thanks

LubOlimex

Hey,

Most of the pins of the EXT connector are free to use. There are three pins that I noticed routed to the UEXT connector also - if you use these three signals at the UEXT then you might have troubles using them at the EXT. These are RE0, RE1, and RE2 - part of the SPI respectively - SCL, SDA, and UEXT_CS.

However, the pins you mentioned RF1, RF2 and RB5 seem free from hardware multiplexing. By the way, these pins doesn't seem to be set differently by default - they should behave as GPIOs by default. Generally, it is a mystery to me why you can't use these pins as GPIOs. If there is a problem with these pins it should be most likely in the software assignment for the port.

Yet, some other pins (like RE3 and RE4) might require different setting of ECCPMX or CCP2MX configuration bit. The mentioned pins are set as PWMs by default (not GPIOs).

Best regards.
Lub/OLIMEX
Technical support and documentation manager at Olimex

gg3390

Lub,
Thank you for your reply - yes it is puzzling me too, as pins eo either side of these work - especially in the case of the RB5, when I'm using RB4 and RB3 for example with no problems.
Please see a snippet of code for my assignments

define DQ1_LOW        PORTBbits.RB1=0; TRISBbits.TRISB1= 0;
#define DQ1_RELEASE    TRISBbits.TRISB1 = 1;
#define DQ1_READ       PORTBbits.RB1;

#define DQ2_LOW        PORTDbits.RD2=0; TRISDbits.TRISD2=0;
#define DQ2_RELEASE    TRISDbits.TRISD2=1;
#define DQ2_READ       PORTDbits.RD2;

#define DQ3_LOW        PORTDbits.RD1=0; TRISDbits.TRISD1=0;
#define DQ3_RELEASE    TRISDbits.TRISD1=1;
#define DQ3_READ       PORTDbits.RD1;

#define DQ4_LOW        PORTDbits.RD0=0; TRISDbits.TRISD0=0;
#define DQ4_RELEASE    TRISDbits.TRISD0=1;
#define DQ4_READ       PORTDbits.RD0;

#define DQ5_LOW        PORTBbits.RB2=0; TRISBbits.TRISB2= 0;
#define DQ5_RELEASE    TRISBbits.TRISB2 = 1;
#define DQ5_READ       PORTBbits.RB2;

#define DQ6_LOW        PORTBbits.RB3=0; TRISBbits.TRISB3= 0;
#define DQ6_RELEASE    TRISBbits.TRISB3 = 1;
#define DQ6_READ       PORTBbits.RB3;

#define DQ7_LOW        PORTBbits.RB5=0; TRISBbits.TRISB5= 0;
#define DQ7_RELEASE    TRISBbits.TRISB5 = 1;
#define DQ7_READ       PORTBbits.RB5;

#define DQ8_LOW        PORTEbits.RE0=0; TRISEbits.TRISE0= 0;
#define DQ8_RELEASE    TRISEbits.TRISE0 = 1;
#define DQ8_READ       PORTEbits.RE0;

#define DQ9_LOW        PORTEbits.RE1=0; TRISEbits.TRISE1= 0;
#define DQ9_RELEASE    TRISEbits.TRISE1 = 1;
#define DQ9_READ       PORTEbits.RE1;


DQ1-6 work with no issue - but I cannot get anything on 7-8, and there are others throughout also.
However, I cannot find anywhere within the code where these pins (i.e. RB5) is being used or reassigned to something else. Furthermore, I note your comments on UEXT, but am not using that - I specifically picked pins that have no reference in the current PIC-WEB RevC schematic.
Ive tested the pins for continuity to the header, and this is all in order - Ive also reflashed the board with a small test LED program on said pins and they indeed do work - just not with the PIC-WEB code.
Any ideas where the software assignments within the default PIC-WEB 5.42 code might be?

Thanks again

Stanimir5F

Hi gg3390!

I have just tested the default software with a LED attached to any of the mentioned of you pins (B5, E0, E1, F0, F1) and changed the LED configuration (inside the file "HWP OLIMEX_PIC_WEB.h", lines 89-90) to the respective port and pin. Then I tried to toggle the LED on the webpage and it worked.

Can you try this and tell me if you still have problems? Because it seems the GPIO function of these pins works fine.

Stan, Olimex
May the Source be with You!