How to read data fron GPIO pins

Your source for all things Atmel.

Moderator: phalanx

Post Reply
Mr. A
Posts: 18
Joined: Thu Jul 29, 2010 3:03 am

How to read data fron GPIO pins

Post by Mr. A » Wed Sep 08, 2010 3:11 am

hiiiiiiiiiiii...

I am trying to get data from GPS on GPIO pins of AT91SAM7S256.But,i am facing problem in writing the code for read the GPIO data.
pl guide me to write the code to read data and then save it to buffer for further programming.

stevech
Support Volunteer
Posts: 2907
Joined: Sat Jun 05, 2004 8:51 pm
Location: USA, California

Re: How to read data fron GPIO pins

Post by stevech » Wed Sep 08, 2010 11:04 pm

GPS receivers often use UART serial with NMEA.
GPIO bits would be used for what sort of GPS receiver? A few have I2C or SPI rather than UART.

tecoist
Posts: 160
Joined: Mon Aug 30, 2010 6:22 pm

Re: How to read data fron GPIO pins

Post by tecoist » Thu Sep 09, 2010 1:40 am

For what it's worth, the part you mention is actually an ARM microcontroller, not an AVR part.

You don't mention which GPS module you're using, but most of them emit serial data. I'd suggest using one of the two USARTs on the AT91SAM7S256; the Atmel manual is available on line here. The part also supports TWI and SPI if your GPS speaks those rather than asynchronous serial.

Mr. A
Posts: 18
Joined: Thu Jul 29, 2010 3:03 am

Re: How to read data fron GPIO pins

Post by Mr. A » Thu Sep 09, 2010 3:37 am

Can i use GPIO pins as RX & TX of USART???????
If yes,then tell me that how can i read save the data of GPIO pins in a buffer?????????

stevech
Support Volunteer
Posts: 2907
Joined: Sat Jun 05, 2004 8:51 pm
Location: USA, California

Re: How to read data fron GPIO pins

Post by stevech » Thu Sep 09, 2010 8:15 pm

Mr. A wrote:Can i use GPIO pins as RX & TX of USART???????
If yes,then tell me that how can i read save the data of GPIO pins in a buffer?????????
No, you would use one of the built-in UARTs of the microprocessor, and config. that to the relevant pins of the chip/module. If you have no spare UART to use, you could try to do a software UART but that gets quite complex in terms of interrupts, etc.

Post Reply