UKHAS Wiki

UK High Altitude Society

User Tools

Site Tools


code:interrupt_driven_ubx

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
code:interrupt_driven_ubx [2009/05/11 09:45] laurencebcode:interrupt_driven_ubx [2009/05/11 20:17] (current) laurenceb
Line 1: Line 1:
 under construction... under construction...
 +
 +
 +
 +
  
 ===== demo code ===== ===== demo code =====
  
 <code c> <code c>
- 
 #include <stdlib.h> #include <stdlib.h>
 #include <stdio.h> #include <stdio.h>
Line 39: Line 42:
  if(Gps.packetflag==REQUIRED_DATA)  if(Gps.packetflag==REQUIRED_DATA)
  {  {
- printf("%d,%d,%d,%d,%d\n",Gps.latitude,Gps.longitude,Gps.altitude,Gps.status,Gps.nosats);+ printf("%li,%li,%li,%2X,%2X\n",Gps.latitude,Gps.longitude,Gps.altitude,Gps.status,Gps.nosats);
  Gps.packetflag=0; //unlock the data  Gps.packetflag=0; //unlock the data
  }  }
Line 47: Line 50:
 ISR(USART_RX_vect) //UART interrupt on mega xx8 series ISR(USART_RX_vect) //UART interrupt on mega xx8 series
 { {
- static u08 state,class,id,checksum_1,checksum_2;+ static u08 state,class,id,checksum_1,checksum_2,counter;
  static u16 lenght;  static u16 lenght;
  static ubx_gps_type gps;  static ubx_gps_type gps;
Line 79: Line 82:
  case 5: //the most significant byte  case 5: //the most significant byte
  lenght|=c<<8;  lenght|=c<<8;
 + counter=0;
  state=6;  state=6;
  break;  break;
Line 96: Line 100:
  if(id==SOL_DATA && lenght==SOL_POS)  if(id==SOL_DATA && lenght==SOL_POS)
  gps.status=c;  gps.status=c;
- if(id==SVINFO_DATA && lenght==SATS_POS) + if(id==SOL_DATA && lenght==SATS_POS) 
- gps.nosats=c;+ gps.nosats=c;  
 + /*if(id==SVINFO_DATA)//this appears to find the number of hardware channels avaliable 
 +
 + counter++;//this counts from the start of data 
 + if(counter==SATS_POS) 
 + gps.nosats=c; 
 + }*/
  }  }
  lenght--;  lenght--;
Line 144: Line 154:
 } }
 </code> </code>
 +
  
 ===== header ===== ===== header =====
-<code c> +<code c>typedef unsigned char u08;
-typedef unsigned char u08;+
 typedef uint16_t u16; typedef uint16_t u16;
 typedef uint32_t u32; typedef uint32_t u32;
Line 171: Line 181:
 #define NAV_CLASS 0x01 #define NAV_CLASS 0x01
 #define SATS_POS 5 #define SATS_POS 5
-#define SOL_POS 11+#define SOL_POS 42
 #define POS_OFFSET 40 #define POS_OFFSET 40
 #define POS_START 12 #define POS_START 12
code/interrupt_driven_ubx.1242035110.txt.gz · Last modified: 2009/05/11 09:45 by laurenceb

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki