Dear all,
I would like to pass the name of the data table to the sub [b:60257c91be]SUB[/b:60257c91be] in order to use it insight as an argument of the [b:60257c91be]LOOKUP[/b:60257c91be] function.
Have tried to use the [b:60257c91be]bylabel[/b:60257c91be] attribute as illustrated below:
[code:1:60257c91be]
sub Procedure_name(bylabel data_table as word)
[...]
xx=lookup(yy,data_table)
[...]
End Sub
Data_table:
Data 1, 2, 3, ...
[/code:1:60257c91be]
But this approach is not accepted by the compiler.
Very appreciate an exemplary working code or your suggestion how to do this in the right way.
Thanks,
makarak
[/b]
[b:60257c91be][color=red:60257c91be](BASCOM-AVR version : 2.0.7.7 )[/b:60257c91be][/color:60257c91be]
↧
BASCOM-AVR : How to pass the table name to the SUB? : NEWTOPIC
↧
BASCOM-AVR : How to READ from the data table with offset? : NEWTOPIC
The [b:bc77973ec5]READ[/b:bc77973ec5] command is convenient for sequential reading of data from the data table but the [b:bc77973ec5]RESTORE[/b:bc77973ec5] command always sets the data pointer at the beginning of the table.
Could you, please, advise how to skip over a block of data in the table and start sequential reading from the offset point (i.e. Nth element of the table)?
Thanks,
makarak
[b:bc77973ec5][color=red:bc77973ec5](BASCOM-AVR version : 2.0.7.7 )[/b:bc77973ec5][/color:bc77973ec5]
↧
↧
BASCOM-AVR : How to READ from the data table with offset? : REPLY
Processor registers R8/R9 hold the pointer used by Read(), it's possible to add an offset there.
Care has to be taken with processors of > 64k flash, where RAMPZ needs to be taken care of.
↧
BASCOM-AVR : How to pass the table name to the SUB? : REPLY
Test this in simulator :)
[code:1:7db32e09fe]$sim
$regfile = "m8def.dat"
$crystal = 16000000
$hwstack = 64
$swstack = 64
$framesize = 64
Dim Address As Word
Dim N As Byte
Dim Items(5) As Byte
Declare Sub Show_array(byval Address As Word , Byval Linia As Byte)
Cls
Address = Loadlabel(label_1)
Call Show_array(address , 1)
Address = Loadlabel(label_2)
Call Show_array(address , 2)
'** pro forma
Do
nop
Loop
End
'** End **
Sub Show_array(byval Address As Word , Byval Linia As Byte)
Locate Linia , 1
Loadadr Address , X
!LD R8,X+
!LD R9,X
For N = 1 To 5
Read Items(n)
Lcd Items(n) ; " "
Next
End Sub
Label_1:
Data 1 , 2 , 3 , 4 , 5
Label_2:
Data 5 , 4 , 3 , 2 , 1[/code:1:7db32e09fe]
Have a nice day
↧
BASCOM-AVR : 4094 Multiple 7 segment LCD : NEWTOPIC
Hi Forum,
Hope you are all well.
I am currently working with Interfacing Multiple 7 segment crystal LCD with 4094 + ATMEGA16 but LCD is showing abnormal behavior. I have attached snapshot of the LCD. Also i do not have LCD Datasheet but 4094 is connected to each other in cascade. It is already working LCD from other machine.
Here are my code:
$regfile = "m16def.dat"
$crystal = 11059200 '8000000
Config Porta.6 = Output
Config Porta.7 = Output
Config Portc.2 = Output
Datain Alias Porta.6
Clock Alias Porta.7
Strobe Alias Portc.2
Dim Kodesat As Byte , Npul As Integer , Nsat As Integer , Kodepul As Byte
Mulai:
Npul = 3
Nsat = 0
Do
Gosub Tampil
If Nsat = 0 Then
Nsat = 9
Decr Npul
End If
If Npul = 0 And Nsat = 0 Then
Goto Mulai
End If
Gosub Tampil
Decr Nsat
Loop
Tampil:
Reset Strobe
Kodesat = Lookup(nsat , Kode)
Kodepul = Lookup(npul , Kode)
Shiftout Datain , Clock , Kodesat , 1
Waitms 500
Shiftout Datain , Clock , Kodepul , 1
Waitms 500
Set Strobe
Waitms 500
Return
Kode:
Data &H40 , &H79 , &H24 , &H30 , &H19 , &H12 , &H02 , &H78 , &H00 , &H10
'Data &B11000000 '0
'Data &B11111001 '1
'Data &B10100100 '2
'Data &B10110000 '3
'Data &B10011001 '4
'Data &B10010010 '5
'Data &B10000010 '6
'Data &B11111000 '7
'Data &B10000000 '8
'Data &B10010000 '9
[b:ed524df826][color=red:ed524df826](BASCOM-AVR version : 1.11.9.5 , Latest : 2.0.7.7 )[/b:ed524df826][/color:ed524df826]
↧
↧
Share your working BASCOM-AVR code here : S6D1121 LCD library : REPLY
Hi Mrshilov
Which type of SPI-ROM do you use?
Regards
Thomas
↧
BASCOM-AVR : 4094 Multiple 7 segment LCD : REPLY
Does the image stay steady or does it fade away? The data you are sending is position followed by 7 segment data? Is that correct?
Ben Zijlstra
↧
Share your working BASCOM-AVR code here : S6D1121 LCD library : REPLY
I use Winbond 25X80A.
↧
BASCOM-AVR : 4094 Multiple 7 segment LCD : REPLY
Hope someone can understand the design.
i do not understand why not it is showing the correct data on the screen.
I have attached a photo of the LCD 7 segment for your information.
Its really different board ... schematic is below connection of 7 segment:
DATA 4094 PINS:
Q1 ----- > other segment (for example : Segment 1)
Q2 ----- > other segment (for example : Segment 2 or second row)
Q3----- > other segment
Q4----- > other segment
Q5 ----- > other segment
Q6----- > other segment
Q7----- > other segment
Q8----- > other segment
I mean to say that all 20 x 4094 connected to each other in cascade style. But every 4094 data pins are connected to 2 different segments. how i can shiftout the data then ?????
for example:
Shiftout Datain , Clock , &B11110000, 1
Means :: 1111 goes to other segment and 0000 goes to other Segment. so i see the abnormal data on the LCD.
↧
↧
BASCOM-AVR : 4094 Multiple 7 segment LCD : REPLY
About fading, do a search for DIY 2012 in this forum. You have to alternate backpanel to keep the segments 'on'.
Ben Zijlstra
↧
BASCOM-AVR : UNconfig SERIALIN : NEWTOPIC
Hello everybody,
I have problems undoing a config statement. My AVR is connected to a PC via a Radio link. Both "ends" simulate a RS232 interface, so for the AVR and the PC it isn't much more than a "normal" RS232 communication. Before transferring data I have to initialize the radio Adapter what takes a lot of flash - but works absolutely fine. So, basic communication works!
Because my AVR has to do a lot of other stuff and the baud rate for the radio adapter is fixed 115200 baud I had to implement buffered data receiving...
[code:1:b435ea05b6]
Config Serialin = Buffered , Size = 128
[/code:1:b435ea05b6]
All that works so far, but one of the PC's commands can be "Enter bootloader", what makes the AVR jump to the bootloader section, receive more serial data (guess what: the new program code) and write the flash with SPM up to but not included the bootloader itself.
The bootloader as is works well, too. A small "main" program with initialization of the radio adapter and jump to the bootloader works!
But as soon as I implement the above config statement for IRQ based buffered receiving in the main program, the bootloader will not receive any data any more. What I need is a kind of
[code:1:b435ea05b6]
Config Serialin = TheNormalWay
[/code:1:b435ea05b6]
but it seems to me, there is no statement like that.
As said before I can't do the hole initialization of the radio adapter in the bootloader, I haven't got enough flash there. So the usual way "First bootloader, then main program" doesn't work. And my main definitely needs the buffered receiving. Can anybody help me to make the config statement undone and after buffered receiving in the main program having normal "Waitkey" receiving in the bootloader section?
Thank's
Ralph
[b:b435ea05b6][color=red:b435ea05b6](BASCOM-AVR version : 2.0.7.7 )[/b:b435ea05b6][/color:b435ea05b6]
↧
BASCOM-AVR : 4094 Multiple 7 segment LCD : REPLY
Hi Ben,
Thank you very much for your reply and i have seen that DIY 2012 self Kit using 4094 driver IC and LCD fadding issue.
But here with me the issue is i can not get the correct data on the LCD. I can not see the correct data i shiftout .. as you can see in the first photo i have attached. I actually do no have LCD datasheet so i dont know the pinouts. its 8 x 2 + 5 = total 3 Row and 21 x (7 - Segments ).
It make me confuse because 4094 is not connected to one segement. it is connected to other segment too. I hope you understand the issue
Regards,
Shan
↧
BASCOM-AVR : UNconfig SERIALIN : REPLY
One option would be to enable the watchdog and run into an endless loop, followed by a watchdog reset and jump to the BL. Another option is simply disable interrupts, I suspect the enabled RXC-interrupt to crash your BL, another option is to directly disable the RXC interrupt. The BL routine uses its own code, so nothing more has to be "undone".
↧
↧
BASCOM-AVR : UNconfig SERIALIN : REPLY
Hi
Usually, reset of hardware is given to AVR, and where all the registers and interruption are initialized, it is rewritten by the new program by a boot loader.
Therefore, also when jumping from main program to a boot loader, initialization of a register and prohibition of interruption are needed.
First of all, when jumping from a main program to a boot loader, "Disable Interrupts" is performed, I will think that it is good.
↧
BASCOM-AVR : How to READ from the data table with offset? : REPLY
Hi
"Lookup" if the numeric data.
"Lookupstr" if the string data.
In changing to this instruction, do you have any problems?
↧
BASCOM-AVR : UNconfig SERIALIN : REPLY
Yeah! Disabling the interrupts worked!
So simple. Why didn't I see that? :oops:
Thanks guys!!! :D
↧
BASCOM-AVR : HX711 ADC 24 bits : REPLY
good work !
when you finish it, it would be nice to share your work with other bascom's users in "Share your working BASCOM-AVR code here"
many thanks
JP :wink:
↧
↧
Share your working BASCOM-AVR code here : Problem with comercial i2cslave library from MCS : NEWTOPIC
Hello!
I use the new Version of I2C-Slave-lib:
comment = BASCOM-AVR USI I2C slave library
libversion = 2.0.7.7
date = 8 Jan 2014
I want to use an ATTiny2313 as a Slave and therefore used the following Code (having copied the *.Lib-Files to BASCOM/LIB !):
------------------------------------------------------------
$regfile = "attiny2313.dat"
$crystal = 8000000
$hwstack = 40
$swstack = 16
$framesize = 24
config USI = twislave , address = &H40
------------------------------------------------------------
This results in the following compiler-error (BASCOM 2077):
Unknown CONFIG parameter [USI]
Unknown CONFIG parameter [ADDress]
I'd appreciate if someone could give me some pointers towards the problems in my code.
Thanks in advance
Ernst
↧
Share your working BASCOM-AVR code here : Problem with comercial i2cslave library from MCS : REPLY
You need to include the I2C library in your code. See Help file on how to use [b:702168f570]include[/b:702168f570]
↧
Share your working BASCOM-AVR code here : Problem with comercial i2cslave library from MCS : REPLY
thank you, the cause was:
I must update the BASCOM Compiler from 2077 Build 2 to 2077 Build 4
problem solved!
Ernst
↧