GPS Interface - Interfacing GPS With AVR Microcontroller Code (Atmega16)
GPS Interface - Interfacing GPS With AVR Microcontroller Code (Atmega16)
Search
Home
Insight
EG Labs Advertise
Forum
GPS Device
GPS Track
GPS Maps
GPS Navigatio
EngineersGarage
Like
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 )
Reed Switch Servo Motor Rotary Switch Webcam Fountain Pen Ding Dong Doorbell Bell Preset Ultrasonic Sensor Piezo Buzzer Earphone Slide Switch ...more
# 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
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 ) ;
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
} } } } } } } } } 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
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 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
/ / 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
Top
www.engineersgarage.com/embedded/avr-microcontroller-projects/gps-interface-circuit
5/5