Well, thanks for all the help Ingvar, but, its not working!!

Ok, i complied the code you provided and got nothing at all. Scratched my head for a few hours, then realized that id been supplied common cathode instead of common anode digits. No problem, made the 0's 1's and vice versa, and nothing.

Added pull down resistors to get a good ground and things started to shape up.

However, i was seeing the same info on two digits. I had an output connected to MCLR, which is a no no. Relocated and data on all three digits at last.
Unfortunatly, the data is garbage, no numbers at all.

Checked, recheck and checked again all the connections, everything was connected correctly to the oputputs. Still getting garbage.

Wrote a small program to cycle through the segments one at a time to see if id used the wrong pinout data.
All correct, RB0 equalled the first segment, all the way to RB6 equalls last segment - wired correctly, programmed correctly.

Getting frustrated now.

Problems i have now:

1. Wrong info ouptut to displays
2. only getting 1 sample from the ADC
3. not updating display - allways shows first ADC value

1. No idea what the problem is. I have slowed everything down to display the data on each of the 3 digits for 1 second each. Data is not different if i spend 1 second or 1ms at each display. So i dont think there is a timing issue.

2. So far ive managed to get a grand total or 2 readings max out of the adc by reading the adc, writing it to eeprom, pausing 10, then reading it back, giving it a different name and using that name to send to the display.

UPDATE
I tweaked the settings of portA and the ADC and managed to get samples out now but the values are very close together when im swinging the input from near 0v to 4.5v. There is still no update on the display.

3. How do i know im getting samples?? Well i take an adc reading every 100ms and write it to eeprom. I do this for 16 samples at 16 different locations, then plug the pic into my programmer and read the eeprom data. I can see the data writen over time and see that it varies slightly.
Still, the first sample is taken and i presume displayed since i cant tell exactly what its supposed to on the displays. After that, the display does not change.

Ive tried a number of different programs, one should cycle 0 - 9 on a single digit - compiled, did not work. This was copied from the picbasic website. Cycles garbage. Modified it, displays are better but still not numbers.


The only way i have gotten correct numbers out is by writing the program below, but even this stop cylcling and displays 0 after a while. Yes, i know there isnt anythingh done with the ADC but i left it in anyway.

include "modedefs.bas"
DEFINE OSC 20
DEFINE ADC_BITS 10
DEFINE ADC_CLOCK 3
DEFINE ADC_SAMPLEUS 50
TRISA = %11000001 'set portA
ADCON0 = %11000101 'read as analog
ADCON1 = %00001110
RAW VAR WORD 'Set ADC value to name of RAW
millivolts VAR WORD
psitimes100 var word
Pause 100
TRISB = %00000000 'set portB all outputs
'turn on all digits, set display to be blank at startup
PortA.2 = 0
PortA.3 = 0
PortA.4 = 0
PortB.0 = 1 'A
PortB.1 = 1 'B
PortB.2 = 1 'C
PortB.3 = 1 'D
PortB.4 = 1 'E
PortB.5 = 1 'F
PortB.6 = 1 'G
PortB.7 = 1 'DP

Main
gosub ZERO
pause 1000
Gosub ONE
pause 1000
gosub TWO
pause 1000
gosub THREE
pause 1000
GOSUB FOUR
pause 1000
Gosub FIVE
pause 1000
gosub SIX
pause 1000
gosub SEVEN
pause 1000
gosub EIGHT
pause 1000
gosub NINE
pause 1000

ZERO
PortB.0 = 0 'A
PortB.1 = 0 'B
PortB.2 = 0 'C
PortB.3 = 0 'D
PortB.4 = 0 'E
PortB.5 = 0 'F
PortB.6 = 1 'G
PortB.7 = 1 'DP
Return

ONE
PortB.0 = 1 'A
PortB.1 = 0 'B
PortB.2 = 0 'C
PortB.3 = 1 'D
PortB.4 = 1 'E
PortB.5 = 1 'F
PortB.6 = 1 'G
PortB.7 = 1 'DP
Return

TWO
PortB.0 = 0 'A
PortB.1 = 0 'B
PortB.2 = 1 'C
PortB.3 = 0 'D
PortB.4 = 0 'E
PortB.5 = 1 'F
PortB.6 = 0 'G
PortB.7 = 1 'DP
Return

THREE
PortB.0 = 0 'A
PortB.1 = 0 'B
PortB.2 = 0 'C
PortB.3 = 0 'D
PortB.4 = 1 'E
PortB.5 = 1 'F
PortB.6 = 0 'G
PortB.7 = 1 'DP
Return

FOUR
PortB.0 = 1 'A
PortB.1 = 0 'B
PortB.2 = 0 'C
PortB.3 = 1 'D
PortB.4 = 1 'E
PortB.5 = 0 'F
PortB.6 = 0 'G
PortB.7 = 1 'DP
Return

FIVE
PortB.0 = 0 'A
PortB.1 = 1 'B
PortB.2 = 0 'C
PortB.3 = 0 'D
PortB.4 = 1 'E
PortB.5 = 0 'F
PortB.6 = 0 'G
PortB.7 = 1 'DP
Return

SIX
PortB.0 = 0 'A
PortB.1 = 1 'B
PortB.2 = 0 'C
PortB.3 = 0 'D
PortB.4 = 0 'E
PortB.5 = 0 'F
PortB.6 = 0 'G
PortB.7 = 1 'DP
Return

SEVEN
PortB.0 = 0 'A
PortB.1 = 0 'B
PortB.2 = 0 'C
PortB.3 = 1 'D
PortB.4 = 1 'E
PortB.5 = 1 'F
PortB.6 = 1 'G
PortB.7 = 1 'DP
Return

EIGHT
PortB.0 = 0 'A
PortB.1 = 0 'B
PortB.2 = 0 'C
PortB.3 = 0 'D
PortB.4 = 0 'E
PortB.5 = 0 'F
PortB.6 = 0 'G
PortB.7 = 1 'DP
Return

NINE
PortB.0 = 0 'A
PortB.1 = 0 'B
PortB.2 = 0 'C
PortB.3 = 1 'D
PortB.4 = 1 'E
PortB.5 = 0 'F
PortB.6 = 0 'G
PortB.7 = 1 'DP
Return

goto Main



I will post my code in another reply.


Regards,

James.