SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By lukemalpass
#94228
I made a test board using a PIC and an LCD screen to basically readout the values of the DS touchscreen. I set X1 and X2 to Gnd and Vdd, and Y2 floating, and Y1 as analogue input, then wait 1ms, then read through ADC, then flip it so Y1 and Y2 are Gnd and Vdd and X2 is floating and X1 is analogue input then wait 1ms and read.

I repeat this over and over and output the ADC results on the screen. The board is all SMD, with the DS connector only 2mm away from the PIC with all traces nice and tidy and short. There is a 5V Vreg for battery power and an ICSP connector to program it.

When it is powered through the ICSP by my PICKit it reads 0,0 when nothing is pressed, and then the correct values when pressed for the X and Y. However, when I remove the ICSP and power it from a 6V battery (4x AA) through the Vreg, when nothing is pressed it reads out approximately the center position reading of the screen, but when you press anywhere the readings are still correct, it is just that when on battery power and not pressed the readings are 340x370 approx (which if I touch the center of the screen that is what it reads). Any ideas why this is?

I have a 0.1uF cap right over the PIC power pins which is also right by the DS and I have tried it with and without made no difference. There is also a 0.33uF cap on the input of the reg and a 0.1uf on the output.

Its not really that big of an issue as I intend to use it powered from USB so hopefully it wouldn't have this issue, but I would like to know why this is happening as it may signify a problem with my method.

Luke
By markaren1
#94230
Have you checked that there is 5V on the supply with the regulator and the 6V batt attached (using a DVM etc). ?

Are you using an LDO, or a 7805 regulator ?

-Mark
By lukemalpass
#94242
I haven't checked the voltage no presumed if it powered up a 5V LCD and run the same as when using ICSP that the voltage was fine. I will double check.

I think (haven't got it with me) I am using a TS78M05 but I will double check it, so no it isn't a LDO. I just stuck a 6V on there to see if it would run happy before trying a 9V and it worked so looked no further. I will check all that later and also try with a 9V to see if there is any difference.

What do you think would cause it as even if the voltage was lower the ADC would still use the Vdd as a reference and it reports all the measurements accurately when pressed, just this odd behaviour when not pressed?
By lukemalpass
#94368
Checked voltage was 5v, and tried with 9V battery, same results. Will post code when I get home showing how I am reading the values and see if you can spot any issues even though it works fine when powered from ICSP
By markaren1
#94395
Check pulse amplitude from the uP using a scope.

Sounds like a logic 0 is not being asserted correctly, or Vref is low.

Measure voltages around the uP with 9V/reg and compare with ICSP

-Mark

FYI drop out for the TS78Mxx is 2V, which seems a bit high...