Sunteți pe pagina 1din 5

2/12/13

GPS Interface | Interfacing GPS with AVR Microcontroller (Atmega16)

Search

Home

Insight

EG Labs Advertise

Articles Post & Earn

Invention Stories Contact Us

Forum

Knowledge Base Ads by Google JOIN US ON FACEBOOK FOR LATEST UPDATES

GPS Device

GPS Track

GPS Maps

GPS Navigatio

How to interface GPS with AVR microcontroller (ATmega16)


AVR024 Description Circuit Diagram Video Code Summary Components

EngineersGarage
Like

INSIGHTDISCOVER HOW GADGETS WORK?

Winstar-LCD Module
www.winstar.com.tw
/ /P r o g r a mt og e tl a t i t u d ea n dl o n g i t u d ev a l u ef r o mG P Sm o d e ma n dd i s p l a y / * L C DD A T Ap o r t P O R TA s i g n a lp o r t P O R TB r s P B 0 r w P B 1 e n P B 2 * / # d e f i n eF _ C P U1 2 0 0 0 0 0 0 U L # i n c l u d e < a v r / i o . h > # i n c l u d e < u t i l / d e l a y . h > # d e f i n eU S A R T _ B A U D R A T E4 8 0 0 # d e f i n eB A U D _ P R E S C A L E( ( ( F _ C P U/( U S A R T _ B A U D R A T E*1 6 U L ) ) )-1 )

LCD display-monochrome TN/STN/TFT LCM, color STN, CO

Reed Switch Servo Motor Rotary Switch Webcam Fountain Pen Ding Dong Doorbell Bell Preset Ultrasonic Sensor Piezo Buzzer Earphone Slide Switch ...more

MEHARNAGASURESH Invite a friend My account Create content

# d e f i n eL C D _ D A T AP O R T A
Log out

/ / L C Dd a t ap o r t

# d e f i n ec t r lP O R T B # d e f i n ee nP B 2 # d e f i n er wP B 1 # d e f i n er sP B 0

/ / e n a b l es i g n a l / / r e a d / w r i t es i g n a l / / r e s i s t e rs e l e c ts i g n a l
1/5

www.engineersgarage.com/embedded/avr-microcontroller-projects/gps-interface-circuit

2/12/13

GPS Interface | Interfacing GPS with AVR Microcontroller (Atmega16)

Microcontroller Tutorial

v o i dL C D _ c m d ( u n s i g n e dc h a rc m d ) ; v o i di n i t _ L C D ( v o i d ) ; v o i dL C D _ w r i t e ( u n s i g n e dc h a rd a t a ) ; v o i dL C D _ w r i t e _ s t r i n g ( u n s i g n e dc h a r* s t r ) ;

Electrical v o i du s a r t _ i n i t ( ) ; Engineering Careers Electronic Circuit Design

u n s i g n e di n tu s a r t _ g e t c h ( ) ;

u n s i g n e dc h a rv a l u e , i , l a t i _ v a l u e [ 1 5 ] , l a t i _ d i r ,l o n g i _ v a l u e [ 1 5 ] ,l o n g i _ d i r , i n tm a i n ( v o i d )

Best Microcontroller { Kits Buy Cheap Computers Turbo-c Programming Upgrade Your Processor Servo Motor Controller

ads by Yahoo!

D D R A = 0 x f f ; / / L C D _ D A T Ap o r ta so u tp u tp o r t D D R B = 0 x 0 7 ; / / c t r la so u tp u t i n i t _ L C D ( ) ; / / i n i t i a l i z a t i o no fL C D _ d e l a y _ m s ( 5 0 ) ; / /d e l a yo f5 0m i l is e c o n d s L C D _ w r i t e _ s t r i n g ( " w ea t " ) ; L C D _ c m d ( 0 x C 0 ) ; u s a r t _ i n i t ( ) ; / /i n i t i a l i z a t i o no fU S A R T w h i l e ( 1 ) { v a l u e = u s a r t _ g e t c h ( ) ; i f ( v a l u e = = ' $ ' ) { v a l u e = u s a r t _ g e t c h ( ) ; i f ( v a l u e = = ' G ' ) { v a l u e = u s a r t _ g e t c h ( ) ; i f ( v a l u e = = ' P ' ) { v a l u e = u s a r t _ g e t c h ( ) ; i f ( v a l u e = = ' G ' ) { v a l u e = u s a r t _ g e t c h ( ) ; i f ( v a l u e = = ' G ' ) { v a l u e = u s a r t _ g e t c h ( i f ( v a l u e = = ' A ' ) { v a l u e = u s a r i f ( v a l u e = = {

www.engineersgarage.com/embedded/avr-microcontroller-projects/gps-interface-circuit

2/5

2/12/13

GPS Interface | Interfacing GPS with AVR Microcontroller (Atmega16)

} } } } } } } } } v o i di n i t _ L C D ( v o i d ) {
www.engineersgarage.com/embedded/avr-microcontroller-projects/gps-interface-circuit 3/5

2/12/13

GPS Interface | Interfacing GPS with AVR Microcontroller (Atmega16)

L C D _ c m d ( 0 x 3 8 ) ; _ d e l a y _ m s ( 1 ) ; L C D _ c m d ( 0 x 0 1 ) ; _ d e l a y _ m s ( 1 ) ; L C D _ c m d ( 0 x 0 E ) ; _ d e l a y _ m s ( 1 ) ; L C D _ c m d ( 0 x 8 0 ) ; _ d e l a y _ m s ( 1 ) ; r e t u r n ; }

/ / i n i t i a l i z a t i o no f1 6 X 2L C Di n8 b i tm o d e

/ / c l e a rL C D

/ / c u r s o rO N

/ /8g ot of i r s tl i n ea n d0i sf o r0 t

v o i dL C D _ c m d ( u n s i g n e dc h a rc m d ) { L C D _ D A T A = c m d ; c t r l= ( 0 < < r s ) | ( 0 < < r w ) | ( 1 < < e n ) ; _ d e l a y _ u s ( 4 0 ) ; c t r l= ( 0 < < r s ) | ( 0 < < r w ) | ( 0 < < e n ) ; / / _ d e l a y _ m s ( 5 0 ) ; r e t u r n ; }

v o i dL C D _ w r i t e ( u n s i g n e dc h a rd a t a ) { L C D _ D A T A =d a t a ; c t r l=( 1 < < r s ) | ( 0 < < r w ) | ( 1 < < e n ) ; _ d e l a y _ u s ( 4 0 ) ; c t r l=( 1 < < r s ) | ( 0 < < r w ) | ( 0 < < e n ) ; / / _ d e l a y _ m s ( 5 0 ) ; r e t u r n; }

v o i du s a r t _ i n i t ( ) { U C S R B| =( 1 < < R X C I E )|( 1< <R X E N )|( 1< <T X E N ) ; / /T u r no nt h e U C S R C| =( 1< <U R S E L )|( 1< <U C S Z 0 )|( 1< <U C S Z 1 ) ;/ /U s e8 b i t

U B R R L=B A U D _ P R E S C A L E ;/ /L o a dl o w e r8 b i t so ft h eb a u dr a t ev a l u e U B R R H=( B A U D _ P R E S C A L E> >8 ) ;/ /L o a du p p e r8 b i t so ft h eb a u dr a t }

u n s i g n e di n tu s a r t _ g e t c h ( ) {

www.engineersgarage.com/embedded/avr-microcontroller-projects/gps-interface-circuit

4/5

2/12/13

GPS Interface | Interfacing GPS with AVR Microcontroller (Atmega16)

w h i l e( ( U C S R A&( 1< <R X C ) )= =0 ) ;/ /D on o t h i n gu n t i ld a t ah a v eb r e t u r n ( U D R ) ;/ /r e t u r nt h eb y t e } v o i dL C D _ w r i t e _ s t r i n g ( u n s i g n e dc h a r* s t r ) { i n ti = 0 ; w h i l e ( s t r [ i ] ! = ' \ 0 ' ) { L C D _ w r i t e ( s t r [ i ] ) ; i + + ; } r e t u r n ; }

/ / t a k ea d d r e s sv a u eo ft h e

/ /l o o pw i l lg oo n

/ /s e n d i n gd a t ao n

22320 reads

YOU ARE HERE Home


Copyright 2012 EngineersGarage. All rights reserved. Privacy Policy

Top

www.engineersgarage.com/embedded/avr-microcontroller-projects/gps-interface-circuit

5/5

S-ar putea să vă placă și