Quantcast
Channel: MCS Electronics Forum
Viewing all 20563 articles
Browse latest View live

Share your working BASCOM-AVR code here : Fast library for SSD1289 LCD + Proteus Model : REPLY


BASCOM-AVR : Timer resets after interrupt? : REPLY

$
0
0
Hi, What CPU are you using? What are scaler are you using for timer1? Do you see this on real Hardware or just the Simulator? Is you Hardware/Software/Frame stack large enough? Regards Ian Dobson

BASCOM-AVR : Timer resets after interrupt? : REPLY

$
0
0
You need to give as some more info, clock speed, config timer, stack, cpu.

BASCOM-AVR : A Byte copy command similar to Mid? : REPLY

$
0
0
- first of all, when having doubts of what is meant in the help : ask. it is the only way to clear it up and to improve it. [quote:995566b49f]What is meant by "increased"?? Does this mean "changed to"? Or "incremented"?[/quote:995566b49f] To my knowledge when i have something, and it increases, i will end up with more. So it will both change since it is not the same as before and it will be higher than before. incremented is indeed a better word. And incremented by what? by 1 since we use bytes. - sample : you leave out part of the help : "By default, option 3 is used as this will copy a block of memory from one memory location to another location." So this will copy by increasing both source and target address. you will end up with 2 duplicate arrays. [quote:995566b49f]What is the new value of L?[/quote:995566b49f] why dont you simply test that? you can see it in the simulator. but it should not be a surprise. You should do some reading on data types and how much memory they use. off course L will always be the same as W ! The memcopy topic would be the wrong one to explain the result. But since a word is 2 bytes, and a long 4 bytes, the long is big enough to hold any value of W. When we get a lot of questions about a statement/topic we change the help. This will result in less support questions and a better help. But there is no intention to go to a level of lego block help where i spell out how 3 blocks would look like when i stack them together. I know the help is never finished and each version we add more info, but there is a limit to which level of explaining we go. when memcopy is still not clear, then let me know.

Share your working BASCOM-AVR code here : Sorting Long variable type arrays : REPLY

$
0
0
hi Paul thanks. when you have time, send a complete sample which can be compiled. i will include it with the samples.

BASCOM-AVR : A Byte copy command similar to Mid? : REPLY

BASCOM-AVR : Errors in sample file "capture.bas" : NEWTOPIC

$
0
0
Hello dear reader, upon diving into the mysteries of timers once again, I loaded capture.bas from the sample files. The code explorer immediately showed 4 Errors, all in the "Config Timer1...." line. The programm seems to be performing as expected, though. Can I simply disregard these errors, or is there some hidden trap? Thank you Ernst [b:15a650482a][color=red:15a650482a](BASCOM-AVR version : 2.0.7.7 )[/b:15a650482a][/color:15a650482a]

BASCOM-AVR : XMEGA External Christal not work in 2.0.7.7 : NEWTOPIC

$
0
0
I have use a christal with 8 MHz in Version 2.0.7.6. This code works fine. Now in Version 2.0.7.7 it's dont work. [code:1:3c746b0f7c]$crystal = 32000000 ' xmega128 is running on 32 MHz $regfile = "xm128a1def.dat" $lib "xmega.lib" ' add a reference to this lib $loader = &H10000 'configure the systemclock Config Osc = Disabled , Extosc = Enabled , Range = 2mhz_9mhz , Startup = Xtal_256clk 'Set the Multiplication factor and select the clock Reference for the PLL Cpu_ccp = &HD8 Osc_pllctrl = &B11_0_00100 ' EXTERNAL clock Source and Multiplication factor = 4 Bitwait Osc_status.3 , Set 'Check if XOSCRDY is ready Set Osc_ctrl.4 ' PLL enable Config Sysclock = Pll , Prescalea = 1 , Prescalebc = 1_1 [/code:1:3c746b0f7c] [b:3c746b0f7c][color=red:3c746b0f7c](BASCOM-AVR version : 2.0.7.7 )[/b:3c746b0f7c][/color:3c746b0f7c]

BASCOM-AVR : Errors in sample file "capture.bas" : REPLY

$
0
0
you can ignore these 'errors'. Please read what i wrote in the help. 'view code explorer' : In version 2.0.7.7 the code explorer is considered a beta functionality. and related to show errors : [quote:8603a3f7ea]Show Errors This option deserves a warning. The option is turned off by default. It can be useful to find errors but it can also point to errors which are not considered an error for the compiler. The compiler has a separate parser. The parser from the IDE is a different new parser. When the definition files are fully updated, the errors shown will be similar to the errors the compiler will report. At the moment of updating the help, the reported errors are mostly errors caused by missing CONFIG definitions. The reason this option is included is that it can prove to be very useful in some cases. So in short, only the errors reported by the compiler count and the errors reported by the IDE can be used to fix errors while you edit.[/quote:8603a3f7ea]

BASCOM-AVR : XMEGA External Cristal not work in 2.0.7.7 : REPLY

$
0
0
when you change : Config Osc = Disabled to Config Osc = ENABLED it will work as before. In 2077 there is a check on the oscillator status bits that are enabled, but since the internal osc will return a 1 as well, the code keeps checking. So the solution is to enable this bit so it will be part of the test. In the next update this bit is AND-ed when not used so this work around is not required any more.

BASCOM-AVR : Errors in sample file "capture.bas" : REPLY

$
0
0
Thank you for your prompt response Mark. I apologize for not having read the relevant text. Best regards Ernst

BASCOM-AVR : XMEGA Timer and Port Config : NEWTOPIC

$
0
0
Hello, I'm in the midst of developing an small application and do not have a way to test the question below: Imagine the first Timer in PORTE is defined as a timer with an ISR: [code:1:401aea437c]Config Tce0 = Normal , Prescale = 1024 , Resolution = Normal Tce0_per = &H1E ' period register On Tce0_ovf Wait_timer_isr Enable Tce0_ovf , Lo [/code:1:401aea437c] Question: can PORTE.0 (or the other PORTs E1..E3 associated with this Timer) be configured as INPUT or OUTPUT? [b:401aea437c][color=red:401aea437c](BASCOM-AVR version : 2.0.7.7 )[/b:401aea437c][/color:401aea437c]

BASCOM-AVR : Questions regardling Structures, overlays and arrays : NEWTOPIC

$
0
0
Hello all, I have a couple of questions to which I am hoping someone might be able to offer a suggestion. They are: 1. Multi-Dimensional arrays I am trying to create a multi-dimensional structure to work as a buffer in a form such as this VB6 Code: Type typeTx_Buff Dim Tx_Cmd_Wireless_Addr As Word Dim Tx_Cmd_Wireless_Zone As Byte Dim Tx_Cmd_Wireless_bCount As Byte Dim Tx_Cmd_Wireless_CmdAs Byte Dim Tx_Cmd_Wireless_Data As Byte Dim Tx_Cmd_Wireless_Data1 As Byte End Type Public TxBuffer(100) As typeTx_Buff This is my current work around for the structure: [code:1:b8be9e9ecc] Dim Tx_Cmd_Wireless_Addr(20) As Word Dim Tx_Cmd_Wireless_Addr_lobyte As Byte At Tx_Cmd_Wireless_Addr Overlay Dim Tx_Cmd_Wireless_Addr_hibyte As Byte At Tx_Cmd_Wireless_Addr + 1 Overlay Dim Tx_Cmd_Wireless_Zone(20) As Byte Dim Tx_Cmd_Wireless_bCount(20) As Byte Dim Tx_Cmd_Wireless_Cmd(20) As Byte Dim Tx_Cmd_Wireless_Data(20) As Byte Dim Tx_Cmd_Wireless_Data1(20) As Byte [/code:1:b8be9e9ecc] I am hoping that someone may have a better idea/way to create a structure like this. 2. How to overlay a String Var over a Byte array OverLay: [code:1:b8be9e9ecc] Dim Tx_Cmd_Wireless_Addr(20) As Word Dim Tx_Cmd_Wireless_Addr_Str As String * 4 At Tx_Cmd_Wireless_Addr(1) Overlay [/code:1:b8be9e9ecc] The question is, how to repeat the overlay but for a specific element of array "Tx_Cmd_Wireless_Addr(20) ". As an alternate, would it be better to simply use another byte varable with a string overlay, then use MEMCOPY to copy the desired byte array element to this other byte variable for which a String Overlay already exists? This would be slower and take more memory I believe but may be a viable alternative. 3. Is it possible to redim an array on the fly (I think not but maybe there is a way I am not aware of). Thanks in advance all! Tim [b:b8be9e9ecc][color=red:b8be9e9ecc](BASCOM-AVR version : 2.0.7.7 )[/b:b8be9e9ecc][/color:b8be9e9ecc]

BASCOM-AVR : XMEGA Timer and Port Config : REPLY

$
0
0
dear enniom Yes you can use de i/o pin on porte for example general i/o regards Tiny

BASCOM-AVR : XMEGA Timer and Port Config : REPLY


BASCOM-AVR : 4D Systems Library : REPLY

$
0
0
Hello to all. does anyone have experience to convert a Arduino Library (C) to an Bascom-avr Library? I will to create a ViSi Genie (4D-Systems workshop) interface that use the on-board graphic chip this chip can control the uLCD via an AVR micro-controller. The AVR just only send commands to my uLCD and it can play sounds, movies, photo's, and graphical items like buttons, slides, etc. but I have not experience in the language "C" it's for my difficult to do. Can anyone help my with this?....... :)

BASCOM-AVR : Questions regardling Structures, overlays and arrays : REPLY

$
0
0
1. Bascom knows basically only one-dimensional arrays. More dimensions have to be set up and handled by user code. The only two-dimensional built-in array I know, would be an array of strings. There the index is the first dimension, while the addressed string itself is the second dimension. But one needs to use then string functions, while one wants to work maybe with a byte array. The terminator byte is also a waste then and I feel it too complicated. Before using such workarounds, I'd have already written code, to handle these multiple dimensions and project it onto one large byte array. 2. An overlay uses the same memory space of one variable, by laying over another variable on it. That's where the name comes from. The overlaying variable can be of a different type than the overlaid one. The shown sample makes little sense, while it can be done. However, I miss the meaning of overlaying a single string with length of 5 chars (included terminator) onto a word array of 20 words. Overlay does not create a structure, nor can it be repeated by any parameters. 3. No.

BASCOM-AVR : Questions regardling Structures, overlays and arrays : REPLY

$
0
0
just want to add that in the next release arrays can have multiple dimensions like a(1,2,3,4,5).

BASCOM-AVR : 1wire on extended port not working : REPLY

$
0
0
Is planned any update of current HELP and WIKI with this info ? ... and LIB to download - becouse in my lates 2-0-7-7 instalation lib is missing :-(

BASCOM-AVR : SPI slave IRQ doesn't work : NEWTOPIC

$
0
0
Hello everybody, I want to connect 2 atMega168 using SPI. I've connected GND and PB3..5 pins (MOSI/MOSI/SCK) directly (no cross over!). I took the sample code for the slave, but the slave will never receive any data. The ISR is never triggered. Anybody help, please? Thanks Ralph Code for the master: [code:1:317568b295] $regfile = "M168DEF.DAT" ' atMEGA168 $crystal = 8000000 ' 8 MHz Takt Config Portb.3 = Output ' MOSI Config Portb.4 = Input ' MISO Config Portb.5 = Output ' SCK (8MHz / 128 = 62.5kHz) Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = Low , Phase = 0 , Clockrate = 128 , Noss = 1 Spiinit Dim A(1) As Byte A(1) = 42 Do Wait 1 Spiout A(1) , 1 Loop End [/code:1:317568b295] Code for the slave: [code:1:317568b295] $regfile = "M168DEF.DAT" ' atMEGA168 $crystal = 8000000 ' 8 MHz Takt $baud = 115200 Config Pinb.3 = Input ' MOSI Config Pinb.4 = Output ' MISO Config Pinb.5 = Input ' SCK Config Spi = Hard , Interrupt = On , Data Order = Msb , Master = No , Polarity = Low , Phase = 0 , Clockrate = 128 Spiinit On Spi Spi_isr Nosave ' specify the SPI interrupt Enable Spi ' enable spi interrupt Enable Interrupts ' enable global interrupts Dim B As Byte , Rbit As Bit , Bsend As Byte Print "start" ' show that we started Spdr = 0 ' start with sending 0 the first time Do If Rbit = 1 Then ' when data received Print B ' print it Reset Rbit ' wait for more data Bsend = Bsend + 1 Spdr = Bsend ' increase SPDR End If Loop ' Interrupt routine Spi_isr: push r24 ' save used register in r24, sreg ' save SREG push r24 B = Spdr ' Load data Set Rbit ' we received something pop r24 !out sreg, r24 ' restore SREG pop r24 ' and the used register Return [/code:1:317568b295] [code:1:317568b295][/code:1:317568b295] [b:317568b295][color=red:317568b295](BASCOM-AVR version : 2.0.7.7 )[/b:317568b295][/color:317568b295]
Viewing all 20563 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>