Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 21:01 19 Apr 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : PM: Confused about SYSTEM I2C and SETPIN sda,scl,I2C....

     Page 3 of 3    
Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8567
Posted: 10:19am 23 Sep 2022
Copy link to clipboard 
Print this post

Master

SetPin gp0,gp1,i2c
I2C open 100,1000
i=10
Do
i=i+1
a$=Str$(i)
I2C write 50,0,Len(a$),a$
Pause 200
I2C read 50,0,8,a$
Print a$
Pause 200
Loop


Slave

'GP29 is the input voltage divided by 3 and is always set as AIN
SetPin gp2,gp3,i2c2
I2C2 slave open 50,tint,rint
Do :Loop
'
Sub rint
Local count
'Print "RX"
I2C2 slave read 10,a$,count
a$=Str$(Pin(gp29),1,6)
Print a$
End Sub
'
Sub tint
I2C2 slave write 8,a$
'Print "TX"
End Sub


You have a slave write in the receive interrupt.
Edited 2022-09-23 20:20 by matherp
 
     Page 3 of 3    
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024