Hello,
I work with the commercial I2C slave library addon.
[code:1:32252e74ce]comment = BASCOM-AVR USI I2C slave library
libversion = 2.0.7.7
date = 8 Jan 2014
[/code:1:32252e74ce]
This configuration works well - the Master sends with 'I2creceive" 2 Bytes to the Slave and receives an amount of A bytes in reply.
[code:1:32252e74ce] Master Slave
Derivate: ATMega1284 ATMega8
I2C-Lib: Lib "I2C_TWI.LBX"
Transmit/Rec: I2creceive Slave_ad, Config Twislave = &H70 , Btr = A , Bitrate = 100000
Buf(1) , 2 , A
[/code:1:32252e74ce]
This configuration doesn't work so well, when A > 2:
The Master sends with 'I2creceive" 2 Bytes to the Slave and receives 2 Bytes in reply.
But when A>2 then the Slave only send 2 Bytes - no more!
Where can I configure that the Slave sends more than 2 Bytes to the Master?
In the previous configuration I can define how many Bytes the Slave sends to the Master with Btr=A.
[code:1:32252e74ce] Master Slave
Derivate: ATMega1284 ATTiny2313
I2C-Lib: Lib "I2C_TWI.LBX"
Transmit/Rec: I2creceive Slave_ad, config USI = twislave , address = &H70
Buf(1) , 2 , A
[/code:1:32252e74ce]
But that doesn't seem to work here. Does anyone have any Ideas what to change to receive more than 2 bytes?
best greatings,
Ernst
[b:32252e74ce][color=red:32252e74ce](BASCOM-AVR version : 2.0.7.7 )[/b:32252e74ce][/color:32252e74ce]
↧
BASCOM-AVR : I2C commercial slave library addon : NEWTOPIC
↧
BASCOM-AVR : I2C commercial slave library addon : REPLY
Hi,
I also use the i2cslave lib and in my configuration the master can send between 1 and 32 Bytes. I solved it by just Setting the Bytes received to > 32 Bytes and using the i2cstop isr to decide what to do with the data recieved, if the data is a Multi Byte command or the first Byte received if the command is a single Byte.
something like:-
[code:1:3d5b60fd0f]
Twi_stop_rstart_received: 'Single byte commands
#if Debug_irda = 1 : Last_i2c = "s" : #endif
Select Case I2c_command 'En/Dis RFID Reader
Case Is = _rfid_dis
Reset Rfid_enable 'Disable RFID reader
I2c_command = 0
Case Is = _rfid_en
Set Rfid_enable 'Enable RFID Reader
I2c_command = 0
Case Is = _rfid_clear 'Clear RFID Nr
Rfid_number = 0
I2c_command = 0
' Case Is = _reset 'Reboot uC
' Reboot_uc = 1
' I2c_command = 0
Case Is = _firmware_update 'Firmware update command
Firmware_update = 1
I2c_command = 0
End Select
return
Twi_gotdata:
If Twi_btw = 1 Then 'First byte written is command
I2c_command = Twi
Else
I2c_recieved(twi_btw) = Twi
End If
If I2c_command = _irda_send And Twi_btr = _i2c_packet_size_receive Then
Isr_temp = Memcopy(i2c_recieved(2) , Irda_send(1) , _i2c_packet_size_receive )
I2c_command = 0
End If
return
Twi_master_needs_byte:
Select Case I2c_command
Case Is = _read_rfid
Twi = Rfid_number_array(twi_btr ) 'Return RFID byte
If Twi_btr = _i2c_packet_size_rfid Then
I2c_command = 0
End If
Case Is = _irda_rec
Twi = Irda_rec(twi_btr ) 'Return IRDA byte '
If Twi_btr = _i2c_packet_size_send Then
I2c_command = 0
End If
Case Is = _version
Twi = _myversion
I2c_command = 0
Case Else 'Send 00 if things
Twi = &H00 'are screwed up
End Select
return
[/code:1:3d5b60fd0f]
regards
Ian Dobson
↧
↧
BASCOM-AVR : I2C commercial slave library addon : REPLY
thank you Ian,
but that was not the question.
If the Master works with "I2C_TWI.LBX" and Slave works also Twislave than the communication is o.k.
But when the Slave works with "I2c_USI_Slave.Lib" (Attiny2313) then the Slaves givs only 2 correct
Byes back, tha other bytes are not true!
the master sends:
I2creceive Slave_ad, Buf(1) , 2 , A
how can I set the number of bytes(A) , which then sends the slave back to the Master?
[/img]
↧
BASCOM-AVR Old versions : 4094 Multiple 7 segment LCD : REPLY
Hi Ben,
Congratulation !!!!
Thank you very much for your good idea and it worked fine. I can run my difficult LCD connection to 20 x 4094 with that trick.
:P :D
Regards,
Shan
↧
BASCOM-AVR Old versions : 4094 Multiple 7 segment LCD : REPLY
In a mail I suggested to make several arrays type long to cover the 160 segments and put the right bits of the arrays on or off and clock the 160 bits out by every change. Fading should be solved by alternating the backplane power at 30 times a second with an timer interrupt.
Have fun
Ben Zijlstra
↧
↧
BASCOM-AVR : Atemu / AT_emulator.lib : REPLY
I am not sure what you want. the ps2 emulator allows you to emulate a keyboard. Thus, you have some switches and a micro that will behave like a normal ps/2 keyboard.
But from your question i understand that you want to light up the leds from a normal keyboard.
Or do you mean that you want to add a led to your circuit and use that as num lock indicator?
Or did you use a normal keyboard and and the emulator?
↧
BASCOM-AVR : I2C commercial slave library addon : REPLY
Mark has created a new update.
I have tested it. Now it is running.
The new update for the i2c package will be provided by Mark this week for general usage.
[b:2ac3a8e893]problem solved[/b:2ac3a8e893]
Best greatings,
Ernst
↧
BASCOM-AVR : Atemu / AT_emulator.lib : REPLY
Hi,
in the past i used Atmegas as a Keyboard replacement. Now i need the 3 status leds for another project.
In the meantime i took a look into the AT_simulator lib an there are no routines for the LEDs in the lib.
Seems i have to change the lib and add a few lines for the LED. Should not be a big problem.
Are there other informations for .lib writing than in the help files? I would like to expand the Config Atemu line for the additional LEDS settings but dont know under which variable the settings from the config line appear in the .lib.
Regards,
Tobias
↧
BASCOM-AVR : Atemu / AT_emulator.lib : REPLY
So i you want to control the leds of a keyboard.
Getatkbd and getatkbdraw can be used to communicate with a keyboard. ( to process key presses ). What you need to add is code that will send data to the keyboard.
You can take code from the emulator lib to do so.
Here you find more info : [url]http://retired.beyondlogic.org/keyboard/keybrd.htm[/url]
About libs : you can not expand config commands since these are processed by the compiler.
A safe way to experiment with libs is by making a copy of the lib for example copy the lib file to : myExperiment.lib
then include the lib in the code with $lib "myExperiment.lib"
The compiler will find this lib first and use the code from this lib.
The libs contain atmel asm. There are some extensions. Have a look at the mcs.lib and other libs.
↧
↧
Share your working BASCOM-AVR code here : Library for Nokia1616 display : REPLY
Thanks for sharing your excellent libs Mrshilov. As usual there is a lib, circuit and sample. Great :D
↧
Share your working BASCOM-AVR code here : Library for UC1608 display : REPLY
Thank you for sharing your work Mrshilov. It is great. These are nice displays and you made support for all modes. Well done!
↧
BASCOM-AVR : HX711 ADC 24 bits : REPLY
[quote:592580d101]I look at Bascom AVR Help, there is no Dword[/quote:592580d101]
Actually it is mentioned in the language Fundamentals section.
↧
BASCOM-AVR : Local Variables : REPLY
I assume this is Ok ( because it compliles OK) [code:1:8818426bf2]
sub Read_vaisala()
#if isvaisala = 1
local tempstr1 as string * 100
local tempstr2 as string * 20
local temps as single
Retries = 0
Do
Incr Retries
print #1 , ""
Print #1 , ">> reading Vaisala weather"
etc
etc
loop
#endif
end sub
[/code:1:8818426bf2]
but in the interests of not getting into bad habits, this is better?
I realise that the local variables will be created & trashed every time the sub is called.
[code:1:8818426bf2]
sub Read_vaisala()
local tempstr1 as string * 100
local tempstr2 as string * 20
local temps as single
#if isvaisala = 1
Retries = 0
Do
Incr Retries
print #1 , ""
Print #1 , ">> reading Vaisala weather"
etc
etc
loop
#endif
end sub
[/code:1:8818426bf2]
↧
↧
BASCOM-AVR : Local Variables : REPLY
Hello Neil
"I realise that the local variables will be created & trashed every time the sub is called."
Not trashed, I found out that they may still contain their data next time the sub is called so a good Idea to clear them and not to expect them to be empty.
Regards Paul
↧
BASCOM-AVR : Local Variables : REPLY
Good point Paul; obviously in any sub they would be re-assigned to a new value anyway.
↧
BASCOM-AVR : TCXO for atmega 8, 168 or 328 : NEWTOPIC
Hello
someone should put in place unn TCXO 10, 16 or 20,000 Mhz instead of one quartz on Atmega 8, 168, or 328 or otherwise ?
If you have a schema for TCXO with output square wave or sinusoidal, thanks in advance.
Pat / France
[b:1d69db9180][color=red:1d69db9180](BASCOM-AVR version : 2.0.7.3 , Latest : 2.0.7.7 )[/b:1d69db9180][/color:1d69db9180]
↧
BASCOM-AVR : Local Variables : REPLY
[quote:119d2f505b="Paulvk"]I found out that they may still contain their data next time the sub is called so a good Idea to clear them and not to expect them to be empty.[/quote:119d2f505b]
In case the Frame is not overwritten by other locals and the Y-pointer is the same, a local contain its last value.
Btw., the help is pretty clear about locals, filed under Local:
[quote:119d2f505b]Notice that a LOCAL variable is not initialized. It will contain a value that will depend on the value of the FRAME data. So you can not assume the variable is 0. If you like it to be 0, you need to assign it.[/quote:119d2f505b]
So, not much room to discover something unexpected. :D
↧
↧
BASCOM-AVR : UNconfig SERIALIN : REPLY
Hello Rahalph,
You say that your RS232 wireless comunication works fine. Can you inform the transceiver that you use, is the code easy to learn and use and if it is not very expensive
Thanks
Best regards
P_santos
↧
BASCOM-AVR : TCXO for atmega 8, 168 or 328 : REPLY
Pat,
I am not sure what you are asking, but maybe this?
Here are many TCXO, some quite inexpensive.
http://www.ebay.com/sch/i.html?_odkw=crystal+oscillator&_ftrt=901&_sop=12&_sadis=15&_dmd=1&_osacat=0&_ipg=50&_ftrv=1&_from=R40&_trksid=p2045573.m570.l1313&_nkw=crystal+oscillator+TXCO+TCXO&_sacat=0
73, Sid W7QJQ
↧
Share your working BASCOM-AVR code here : send sms receive order sms with tc35 : REPLY
Hello can you please provide a link where I can see the code. Because I am. Having trouble using my gps module
↧