Problem with changing GPS i2c address (bascom and avr)

Status
Not open for further replies.

baby_1

Advanced Member level 1
Joined
Dec 3, 2010
Messages
415
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,298
Activity points
4,277
Hello
i have a gps module (cmps09) i can read data from it but i write another program to change it address. but it doesn't work properly.could you help me on this?

what is my problem?

Code:
$regfile = "m16def.dat"
$crystal = 8000000
$hwstack = 32
$swstack = 32
$framesize = 48
'====================
Config Scl = Portc.0
Config Sda = Portc.1
Config I2cdelay = 20
Const Address_s = &HC0                                      'default shipped Write address
Const Address_r = &HC1
'===========================
Config Single = Scientific , Digits = 1
'================
Declare Sub Writes()
Declare Sub Reads()
'============
Waitms 100


Do
Call Writes()
Waitms 500
Loop

End
'==================
Sub Writes()

I2cinit

I2cstart
I2cwbyte Address_s
I2cstop

I2cstart
I2cwbyte Address_s
I2cwbyte &HA0
Waitms 100
I2cwbyte &HAA
Waitms 100
I2cwbyte &HA5
Waitms 100
I2cwbyte &HCE
I2cstop


I2cstart
I2cwbyte Address_s
I2cwbyte 22
I2cwbyte &HA0
Waitms 100
I2cwbyte &HAA
Waitms 100
I2cwbyte &HA5
Waitms 100
I2cwbyte &HCE
I2cstop


End Sub
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…