🎁📬❄️📦 Holiday Shipping Deadlines are approaching! International customers and domestic ground - get your orders in 12/9/2020 📦❄️📬🎁
0

where can find source of int analogRead(uint8_t)
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

where can find source of int analogRead(uint8_t)

by jimwang90 on Fri Feb 19, 2016 12:46 pm

Pls. tell me where I can find follow source code:
void pinMode(uint8_t, uint8_t);
void digitalWrite(uint8_t, uint8_t);
int digitalRead(uint8_t);
int analogRead(uint8_t);
void analogReference(uint8_t mode);
void analogWrite(uint8_t, int);

thank you

jimwang90
 
Posts: 41
Joined: Sat Jan 23, 2016 10:13 pm

Re: where can find source of int analogRead(uint8_t)

by adafruit_support_bill on Fri Feb 19, 2016 12:49 pm

All those source files are part of the Arduino IDE. Look in:

Arduino\hardware\arduino\cores\arduino

adafruit_support_bill
 
Posts: 79475
Joined: Sat Feb 07, 2009 10:11 am

Re: where can find source of int analogRead(uint8_t)

by jimwang90 on Fri Feb 19, 2016 1:09 pm

can not find !!!?????

already try :C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries

pls. tell me the exactly in which .C or .CPP file !!!! and give me a link of the folder, like I give you !!!!

jimwang90
 
Posts: 41
Joined: Sat Jan 23, 2016 10:13 pm

Re: where can find source of int analogRead(uint8_t)

by adafruit_support_bill on Fri Feb 19, 2016 1:17 pm

can not find !!!?????

You need to open up some files and look.

The are all there in Arduino\hardware\arduino\cores\arduino
look in wiring_analog.c for the analog functions and wiring_digital.c for the digital function.

adafruit_support_bill
 
Posts: 79475
Joined: Sat Feb 07, 2009 10:11 am

Re: where can find source of int analogRead(uint8_t)

by jimwang90 on Fri Feb 19, 2016 1:25 pm

found it , thank you

jimwang90
 
Posts: 41
Joined: Sat Jan 23, 2016 10:13 pm

Re: where can find source of int analogRead(uint8_t)

by dhalbert on Fri Feb 19, 2016 1:32 pm

http://superuser.com/questions/60173/ho ... -windows-7 gives many alternative ways of searching inside files. Notepad++ is one of the recommendations. It's free, nice, and fast

dhalbert
 
Posts: 401
Joined: Tue Feb 17, 2015 6:18 pm

Re: where can find source of int analogRead(uint8_t)

by jimwang90 on Fri Feb 19, 2016 3:49 pm

DO you know anything about TouchScreen.cpp file ? I have to know what different between:
*portOutputRegister(yp_port) &= ~yp_pin;
*portOutputRegister(ym_port) &= ~ym_pin;

and

digitalWrite(_yp, LOW);
digitalWrite(_ym, LOW);

jimwang90
 
Posts: 41
Joined: Sat Jan 23, 2016 10:13 pm

Re: where can find source of int analogRead(uint8_t)

by adafruit_support_bill on Fri Feb 19, 2016 3:55 pm

portOutputRegister is doing direct manipulation of one of the 8-bit GPIO ports. digitalWrite is just writing to one bit at a time.

http://tronixstuff.com/2011/10/22/tutor ... ipulation/

adafruit_support_bill
 
Posts: 79475
Joined: Sat Feb 07, 2009 10:11 am

Re: where can find source of int analogRead(uint8_t)

by jimwang90 on Sat Feb 20, 2016 5:20 pm

Thank you very much.
I'm trying to use your Touch screen function on ILI9341 breakout board, it is a resistance type of touch screen. I still can not use it very well, of course, the sample code can run on the UNO board, but not success on my board.
1. is there any touch screen Controller chip on the ILI9341 breakout board ?
2. I copy and modify your sample code in my system, but it can not work well. For example, I connect Y+ and Y- to the my MCU Digital output, Y- set to high, Y+ set to low, connection X- to MCU analogy to digital pin, set it to A/D function. also set A/D to 10bits conversion, my result is not good. why ? my setting is OK or not?
3. I use Visual Studio to manipulate your code, I use ReadanalogyX() function to read x value, but it is also not work well. the different is that: instead of using portOutputRegister() function, It use digitalWrite() function, why ?

all of above, I need your help use your touch screen on the ILI9341 breakout board.

jimwang90
 
Posts: 41
Joined: Sat Jan 23, 2016 10:13 pm

Re: where can find source of int analogRead(uint8_t)

by adafruit_support_bill on Sun Feb 21, 2016 7:53 am

There is no controller chip for the touch screen. It is a simple 4-wire resistive touch screen. It requires 2 analog inputs and 2 GPIO pins to control.
https://learn.adafruit.com/adafruit-2-d ... ouchscreen
You haven't told s what kind of controller you are tryin to interface to. But most any microcontroller with GPIO and at least 2 analog inputs should be able to use the touchscreen.

adafruit_support_bill
 
Posts: 79475
Joined: Sat Feb 07, 2009 10:11 am

Re: where can find source of int analogRead(uint8_t)

by jimwang90 on Sun Feb 21, 2016 10:16 am

I use MSP430F6638, very stronger. I read another article, say: for example: if measure Y position, add Y+ to Vcc and Y- to Vss, use X+ to A/D input, also set X- OPEN, I will try tomorrow.

also, X+ and X- is 306 Ohm, Y+ and Y-is 570 Ohm, when I touch the screen, the resistance is change or not? how to change?

jimwang90
 
Posts: 41
Joined: Sat Jan 23, 2016 10:13 pm

Re: where can find source of int analogRead(uint8_t)

by adafruit_support_bill on Sun Feb 21, 2016 11:51 am

You need to alternate between energizing and reading the X and Y axis of the screen. This document has some information on how they work and how to read them.
http://www.ti.com/lit/an/slyt209a/slyt209a.pdf

adafruit_support_bill
 
Posts: 79475
Joined: Sat Feb 07, 2009 10:11 am

Re: where can find source of int analogRead(uint8_t)

by jimwang90 on Sun Feb 21, 2016 12:03 pm

X+ and X- is 306 Ohm, Y+ and Y-is 570 Ohm, when I touch the screen, the resistance is change or not? how to change?

jimwang90
 
Posts: 41
Joined: Sat Jan 23, 2016 10:13 pm

Re: where can find source of int analogRead(uint8_t)

by adafruit_support_bill on Sun Feb 21, 2016 3:23 pm

The resistance in the X and Y axis will change with pressure. This is not an capacitive touch sensor you need very firm finger pressure or a stylus to register a touch.

adafruit_support_bill
 
Posts: 79475
Joined: Sat Feb 07, 2009 10:11 am

Re: where can find source of int analogRead(uint8_t)

by jimwang90 on Sun Feb 21, 2016 8:48 pm

how to change? every point is not same ?
or for example X+ and X-, it is the same from bottom to top, only change from left to right

jimwang90
 
Posts: 41
Joined: Sat Jan 23, 2016 10:13 pm

Please be positive and constructive with your questions and comments.