Hi
I am using Atmega32, having OC1A and OC1B I want to generate 1khz at one channal while 100hz at other channal. 1kHz will be used to drive an voltage doubler for high side mosfet drive and 100hz for controlling pwm.
my question is it possible to do it with the said UC.
[b:e79f9253a0][color=red:e79f9253a0](BASCOM-AVR version : 2.0.7.8 )[/b:e79f9253a0][/color:e79f9253a0]
↧
BASCOM-AVR : Different frequencies : NEWTOPIC
↧
BASCOM-AVR : XMega USB Support : REPLY
Just showing my interest here for the Xmega USB support.
I have purchased the USB Add on.
Have project in final design stage, need to make determination of the USB support on the board.
Not pushing, but is there any update on this Mark?
TIA,
Mark
↧
↧
BASCOM-AVR : Two different $timeout values for COM1 and COM2 in ATMEGA128 : REPLY
the way to do it :
$timeout=100000
input #1,S 'get some string data from COM1
'before using it on COM2 , just change the timeout
$timeout=400000
input #2,s 'longer timeout on COM2
so basically, you need to define the timeout before using the UART.
↧
BASCOM-AVR : Atxmega32e5 : REPLY
I want to use both the uarts on portD, but de compiler give a error "uart is not available " on com4
The second problem i get is how to calibrate the 32mhz internal clock?
i get a error "Error : 41 Line : 158 Variable can not be used with SET [DFLLRC2M_CTRL]
regard Tiny
[code:1:e2a2cd1fc3]
'*******************************************************************************
$regfile = "xm32E5def.dat"
$crystal = 32000000 '32MHz
$hwstack = 60
$swstack = 30
$framesize = 30
Config Submode = New
'*******************************************************************************
' Config Clock
'*******************************************************************************
Config Osc = Enabled , 32mhzosc = Enabled , 32khzosc = Enabled
Osc_dfllctrl = &B00000000
'Enable DFLL and autocalibration
Set Dfllrc2m_ctrl.0
Set Dfllrc32m_ctrl.0
Config Sysclock = 32mhz , Prescalea = 1 , Prescalebc = 1_1
'*******************************************************************************
' Config compoort
' Com4 as direct serial port to main cpu
' Com3 as RS485 bus communication port
'*******************************************************************************
Config Com4 = 115200 , Mode = Asynchroneous , Parity = None , Stopbits = 1 , Databits = 8
Open "COM4:" For Binary As #3
Config Com3 = 19200 , Mode = Asynchroneous , Parity = None , Stopbits = 1 , Databits = 8
Config Portd.1 = Output ' Dir rs485
Config Print = Portd.1 , Mode = Set
[/code:1:e2a2cd1fc3]
↧
BASCOM-AVR : Atxmega32e5 : REPLY
- DFLLRC2M_CTRL : this register is not available in this chip so you can not set it. The fact that the IDE does not color this register gives that away too.
- the config comx in the help shows the map of the usarts. use com1 and com3 since only usartc0 and usartd0 exists in this chip!
↧
↧
BASCOM-AVR : Atxmega32e5 : REPLY
Oke thats clear,
how do i calibrate the internal 32mhz clock then ?
regard Tiny
↧
Share your working BASCOM-AVR code here : pressure and temperature sensor BMP180 : NEWTOPIC
hello,
that it not my job, the main job come from MAK3
I only adapt the code for the BMP 85 for new mode and .inc files and I change some names of variable because X,X1, X2 are used many times when you use display.
MaK3 do a nice job.
this sensor is done by Bosch Sensortec
JP :wink:
↧
BASCOM-AVR : RS485 Xmega : NEWTOPIC
Finally got my xMega128A1U powered LED driver boards back from the PCB fabhouse from china.
Now, I am in the process of getting the bootloader working.
But for some reason, the RS485 is not transmitting. It worked fine on my old Atmega128 stuff. But not this one.
Here is my UART Setup code. Any ideas?
[code:1:3a86f74c32]
'Configure RS-232 RJ45
Config Com5 = 57600 , Mode = Asynchroneous , Parity = None , Stopbits = 1 , Databits = 8 ' use USART E0,E1,F0
'Configure RS-485
Config Com6 = 57600 , Mode = Asynchroneous , Parity = None , Stopbits = 1 , Databits = 8 ' use USART E0,E1,F0
'Setup for RS-485 Half-Duplex.
Config Print5 = Porte.4 , Mode = Set
Config Porte.4 = Output
Reset Porte.4
'Configure RS-232 RF
Config Com7 = 57600 , Mode = Asynchroneous , Parity = None , Stopbits = 1 , Databits = 8 ' use USART E0,E1,F0
'COM0-USARTC0, COM1-USARTC1, COM2-USARTD0. etc.
Open "Com5:" For Binary As #1
Open "Com6:" For Binary As #2
Open "Com7:" For Binary As #3
[/code:1:3a86f74c32]
Thanks.
[b:3a86f74c32][color=red:3a86f74c32](BASCOM-AVR version : 2.0.7.8 )[/b:3a86f74c32][/color:3a86f74c32]
↧
BASCOM-AVR : RS485 Xmega : REPLY
Nevermind. It works fine..
its just bugs bugs bugs in my bootloader code.
↧
↧
BASCOM-AVR : RS485 Xmega : REPLY
I cant get ischarwaiting working in the main application code though. No matter what I send it, it never acknowledges anything was sent.
↧
BASCOM-AVR : RS485 Xmega : REPLY
I absolutely cannot get UART recieve working in the main application. bootloader is ok.
Here is my UART code:
[code:1:8f79aa355b]
Config Priority = Static , Vector = Application , Lo = Enabled ', Med = Enabled , Hi = Enabled 'Init Interrupts
'Configure RS-232 RJ45
Config Com5 = 57600 , Mode = Asynchroneous , Parity = None , Stopbits = 1 , Databits = 8 ' use USART E0,E1,F0
'Configure RS-485
Config Com6 = 57600 , Mode = Asynchroneous , Parity = None , Stopbits = 1 , Databits = 8 ' use USART E0,E1,F0
'Setup for RS-485 Half-Duplex.
Config Print5 = Porte.4 , Mode = Set
Config Porte.4 = Output
Reset Porte.4
'Configure RS-232 RF
Config Com7 = 57600 , Mode = Asynchroneous , Parity = None , Stopbits = 1 , Databits = 8 ' use USART E0,E1,F0
'COM0-USARTC0, COM1-USARTC1, COM2-USARTD0. etc.
Open "COM5:" For Binary As #1
Open "COM6:" For Binary As #2
Open "COM7:" For Binary As #3
'Declare databuffers
Config Serialin4 = Buffered , Size = 254 ' We are using the hardware UART, in buffered interrupt mode.
Config Serialin5 = Buffered , Size = 254 ' We are using the hardware UART, in buffered interrupt mode.
Config Serialin6 = Buffered , Size = 254 ' We are using the hardware UART, in buffered interrupt mode.
Enable Usarte0_rxc , Lo
Enable Usarte1_rxc , Lo
Enable Usartf0_rxc , Lo
Enable Interrupts 'Enable interrupts, buffered UART will operate now.
[/code:1:8f79aa355b]
And my mainloop is something like this:
[code:1:8f79aa355b]
Do
If IsCharWaiting(#1) = 1 then
'Do some UART stuffs here
Elseif IsCharWaiting(#2) = 1 then
'Do some UART2 stuffs here
elseif IsCharWaiting(#3) = 1 then
'Do some UART3 stuffs here
end if
'Other non-uart related code here
loop
[/code:1:8f79aa355b]
The above works great on everything but my xMega
what gives?
↧
BASCOM-AVR : RS485 Xmega : REPLY
I figured it out. Bad programming on my part i think?
I set all my port directions as output prior to declaring the UARTs. Since all my ports primarily are outputs.
But, defining the UARTs dont auto-fix the direction for RXC as regular ATmegas.
So the UARTs didnt work. Removing the direction change for the UART ports, fixed it.
↧
BASCOM-AVR : RS485 Xmega : REPLY
It usually helps to read the manual :evil: :evil:
BTW these lines:
Config Com7 = 57600 , Mode = Asynchroneous , Parity = None , Stopbits = 1 , Databits = 8 ' use USART E0,E1,F0
Your spelling of "Asynchroneous" is probably wrong
↧
↧
Share your working BASCOM-AVR code here : pressure and temperature sensor BMP180 : REPLY
Thanks for sharing JP !
↧
BASCOM-AVR : Two different $timeout values for COM1 and COM2 in ATMEGA128 : REPLY
Thanks Mark for your prompt answer.
Maybe I was not very clear in my previous post, so let me explain the issue a little bit longer.
Iam using two different interrupts for reciving data from COM1 and COM2.
COM1 is configuered for 1200 Bauds (radio remote control) and COM2 for 115200 Bauds (bluetooth Android application)
In both cases the data lengh can varry from 8 to 32 bytes, so I use &timeout to quickly return from the interrupt.
I dont know whitch COM will receve data, so I am not able to preconfigure $timeout in advance.
Can I have dedicated &timeoutCOM1 and &timeoutCOM2 rardless the expexted recived data order?
↧
BASCOM-AVR : Different frequencies : REPLY
The Bascom samples show how to use a timer to generate any frequency, and certainly 1 Khz is possible. 100Hz is also posible to generate simultaeously on another output.
But its not so easy to generate a precise frequency and use the AVR hardware for PWM also. The big steps in the clock prescalers mean you can get for instance about 120 Hz at 8 Mhz clock frequency and still use PWM. Usually this does not matter for PWM, its pretty arbitrary what frequency you use , but it does depend on what your application needs.
↧
BASCOM-AVR : Bascom-AVR 2.0.7.8 IDE high processor load? : NEWTOPIC
I have a rather large project utilizing 90% flash of ATMega2560.
When I load my project with latest release compiler 2.0.7.8, my PC grinds to a halt. Processor usage raises to 100% and editing code is incredibly slow even text takes forever to even show up while typing. The IDE performs the same way on my laptop or my desktop.
Laptop = Intel I7 processor, Windows 8.1, 8GB ram.
Desktop = Intel I7 processor, Windows 7 16GB ram.
To be sure it wasn't my project I downloaded Paulvk "Building a Webserver with a Wiznet W5100"
Located here http://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&t=12358&highlight=wiznet
When I open his project file the IDE grinds to a halt and processor load again goes to 100% most of the time.
Opening my project or Paul's project with version 2.0.7.7 does not exhibit this problem. Is there a new check box or option that needs to be selected to help with this?
Has anyone else seen any similar issue?
Any advice would be greatly appreciated.
Regards,
Jerry
[b:a9cabb5883][color=red:a9cabb5883](BASCOM-AVR version : 2.0.7.8 )[/b:a9cabb5883][/color:a9cabb5883]
↧
↧
BASCOM-AVR : Two different $timeout values for COM1 and COM2 in ATMEGA128 : REPLY
I still do not get it.
you best post a small sample that demonstrate what you do, and how you want it.
The ISR is from the built in buffered serial or your own ring buffer?
And with input you mean you use INPUT statement, right?
My previous explanation would still be valid : specify $timeout before the INPUT statement.
↧
BASCOM-AVR : Bascom-AVR 2.0.7.8 IDE high processor load? : REPLY
That is remarkable. I have I7-8GB too. I loaded Pauls project but it works without any problem.
I have turned all options on. I opened the project in project mode.
I have the latest windows updates too.
For the simulator we made a change for the next update since clearing the code markers was taking a lot of time. Maybe something in a windows updates made this happen since it wasnt noticeable before. But you do not mean the sim but the editor.
The editor uses a separate thread and the only time the editing process is stopped is when the code explorer is updated , when the thread synchronizes.
When your code contain many errors (code explorer errors) it takes more time to add those. So you could turn off showing errors.
You can also hide/close the code explorer.
Pauls project is relatively small. And when this causes cpu load, i wonder how many cores your i7 have?
i can imagine an old XP pc with a single core can be slow but a modern pc should not have any problem.
it is best you run bascom with admin rights first, especially when you did a full install. and store the project in a user writable folder.
you can also send your settings xml file to support so we can check if some combination in options is causing this.
And lastly, you could try a beta from the SLA area.
↧
BASCOM-AVR : Bascom-AVR 2.0.7.8 IDE high processor load? : REPLY
Thank you Mark. Both laptop and desktop I7 have 4 cores. I will try some more and see if I can get any further details.
Jerry
↧