UKHAS Wiki

UK High Altitude Society

User Tools

Site Tools


code:i2c_ubx

Differences

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

Link to this comparison view

Next revision
Previous revision
code:i2c_ubx [2009/05/14 23:46] – created laurencebcode:i2c_ubx [2009/05/27 21:30] (current) – keeping it clean :P laurenceb
Line 54: Line 54:
  u08 a;  u08 a;
  TOGGLE_PIN;  TOGGLE_PIN;
- printf("fuck\n");+ printf("something screwed up\n");
  wdt_enable(WDTO_500MS);  wdt_enable(WDTO_500MS);
  for(;;)  for(;;)
Line 189: Line 189:
 } }
 </code> </code>
 +===== header =====
 +<code c>
 +#include <stdlib.h>
 +#include <stdio.h>
 +#include <avr/interrupt.h>
 +#include <avr/io.h>
 +#include <util/delay.h>
 +typedef unsigned char u08;
 +typedef unsigned int u16;
 +typedef unsigned long u32;
 +typedef signed long s32;
 +typedef struct
 +{
 + u32 time; //milliseconds/week
 + s32 vnorth; //cm/s
 + s32 veast;
 + s32 vdown;
 + s32 longitude; //degrees/10^-7
 + s32 latitude;
 + s32 altitude; //height/mm
 + u08 packetflag; //packetflag lets us see when our packet has been updated
 + u08 status; //type of fix
 + u08 nosats; //number of tracked satellites
 +} ubx_gps_type;
 +#define UBLOX 0x90
 +#define UBLOX_WRITE UBLOX
 +#define UBLOX_READ UBLOX|0x01
 +#define REQUIRED_DATA 0x07
 +#define DATA_LENGHT 130
 +#define LLH_DATA 0x02
 +#define VELNED_DATA 0x12
 +#define SOL_DATA 0x06
 +#define NAV_CLASS 0x01
 +#define SATS_POS 5
 +#define SOL_POS 42
 +#define POS_OFFSET 40
 +#define POS_START 12
 +#define POS_END 25
 +#define VEL_OFFSET 36 
 +#define VEL_START 20
 +#define VEL_END 37
 +#define SYNC_1 0xB5
 +#define SYNC_2 0x62
 +
 +#define BAUDRATE 19200UL
 +//#define BAUDDIV 32
 +#define BAUDDIV  (u16)( ((float)F_CPU/(BAUDRATE*16UL)) -1 )//baud divider
 +#define TOGGLE_PIN PIND=0x20 //led on port D.5
 +
 +</code>
 +
code/i2c_ubx.1242344760.txt.gz · Last modified: 2009/05/14 23:46 by laurenceb

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki