baby_1
Advanced Member level 1
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?
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