Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

problem I2C AS5600

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
marcosx

Bascom Member



Joined: 12 Jan 2010
Posts: 9

poland.gif
PostPosted: Sat Oct 30, 2021 12:17 pm    Post subject: problem I2C AS5600 Reply with quote

HI to all.
I have a problem with I2C AS5600 is an easy to program magnetic rotary position
sensor with a high-resolution 12-bit.



Code:

$regfile = "m328pdef.dat"
$crystal = 16000000

Config Lcd = 16 * 2
Config Lcdpin = Pin , Db4 = Portd.4 , Db5 = Portd.5 , Db6 = Portd.6 , Db7 = Portd.7 , E = Portb.1 , Rs = Portb.0
Cls
Cursor Off

Config I2cdelay = 10
Config Scl = Portc.5
Config Sda = Portc.4

Dim Napiecie As Long                                        'Long
Dim Pomiarh As Byte , Pomiarl As Byte
Dim Wynik As Long

Cls
Lcd "Start"
Wait 1
Cls

Do

      I2cstart
      I2cwbyte 108                                          '108    ' I2cwbyte &B01101100

      I2cstop
      I2cstop
      I2cstart
      I2cwbyte 109                                          ' 109   ' I2cwbyte &B01101101

      I2crbyte Pomiarh , Ack                                'Odczyt Pomiaru
      I2crbyte Pomiarl , Nack
      I2cstop                                               'Bit Stopu
      Waitms 1
      Napiecie = Makeint(pomiarl , Pomiarh)

      Wynik = Napiecie

      Locate 1 , 1
      Lcd Wynik ; "   "

   Wait 1

Loop
 



Compiler version :2.0.8.2
Compiler build :2.0.8.2.003

(BASCOM-AVR version : 2.0.8.4 , Latest : 2.0.8.4 )
Back to top
View user's profile
_jarek_

Bascom Member



Joined: 06 Aug 2014
Posts: 5

poland.gif
PostPosted: Sat Oct 30, 2021 8:19 pm    Post subject: Reply with quote

You are reading "Configuration Registers"

Output registers are in 0C-0F adress.
Back to top
View user's profile
Pikczu

Bascom Member



Joined: 22 Jan 2006
Posts: 72
Location: Dublin, Ireland

ireland.gif
PostPosted: Sun Nov 07, 2021 2:05 pm    Post subject: Reply with quote

If you are interested I have shared the code for 14 bit AS5047D on EDC forum https://bart-projects-forum.cba.pl/viewtopic.php?f=13&t=363
But it is SPI, not I2C.
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum