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

BASCOM-AVR : i have simple problem in my code delay[on/off] relay : NEWTOPIC

$
0
0
i use adc sensor ldr and on/off Relay for 3 second on then off problem the program when Relay on is stoped to read adc how can i read adc and do any thing when Relay on or off dealy [code:1:b5b7be430c] $regfile = "m16def.dat" $crystal = 1000000 '--------------------------- Config Lcdpin = Pin , Db4 = Portb.4 , Db5 = Portb.5 , Db6 = Portb.6 , Db7 = Portb.7 , E = Portb.2 , Rs = Portb.0 Config Lcd = 16 * 2 Cursor Off Cls '----------------------------- Enable Interrupts Config Adc = Single , Prescaler = Auto , Reference = Avcc Start Adc '--------------------------- Config Portc.1 = Output : Reset Portc.1 : Relay Alias Portc.1 '--------------------------- Dim Ldr As Word Dim Setpoint As Word Dim Setpoint_eram As Eram Word At &H00 Dim Setpoint_max As Word Dim Setpoint_min As Word '.......................................................................... Do Gosub Red_temp Gosub Show_temp Gosub Termostat Waitms 300 Loop '*************************************************************** Red_temp: Ldr = Getadc(7) : Ldr = Ldr * 4.8828125 Setpoint = Getadc(6) : Setpoint = Setpoint * 4.8828125 Return '*************************************************************** Show_temp: Locate 1 , 1 : Lcd "LDR:" ; Ldr ; " mV" Locate 2 , 1 : Lcd "Setpoint:" ; Setpoint ; " mV" Return '*************************************************************** Termostat: Setpoint_max = Setpoint Setpoint_min = Setpoint - 10 If Ldr > Setpoint_max Then Reset Relay : Wait 3 : Set Relay Elseif Ldr <= Setpoint_min Then Set Relay : Wait 3 : Reset Relay End If Return '--------------------------------------------------------------- [/code:1:b5b7be430c] [b:b5b7be430c][color=red:b5b7be430c](BASCOM-AVR version : 2.0.7.8 )[/b:b5b7be430c][/color:b5b7be430c]

BASCOM-AVR : i have simple problem in my code delay[on/off] relay : REPLY

$
0
0
Not optimal .. I only add "Timeout" function to Your code [code:1:a02d0868cc]$regfile = "m16def.dat" $crystal = 1000000 '--------------------------- Config Lcdpin = Pin , Db4 = Portb.4 , Db5 = Portb.5 , Db6 = Portb.6 , Db7 = Portb.7 , E = Portb.2 , Rs = Portb.0 Config Lcd = 16 * 2 Cursor Off Cls '----------------------------- Enable Interrupts Config Adc = Single , Prescaler = Auto , Reference = Avcc Start Adc '--------------------------- Config Portc.1 = Output : Reset Portc.1 : Relay Alias Portc.1 '--------------------------- Dim Ldr As Word Dim Setpoint As Word Dim Setpoint_eram As Eram Word At &H00 Dim Setpoint_max As Word Dim Setpoint_min As Word Dim Countdown As Byte '.......................................................................... Do Gosub Red_temp Gosub Show_temp Gosub Termostat Gosub Control Waitms 300 Loop '*************************************************************** Red_temp: Ldr = Getadc(7) : Ldr = Ldr * 4.8828125 Setpoint = Getadc(6) : Setpoint = Setpoint * 4.8828125 Return '*************************************************************** Show_temp: Locate 1 , 1 : Lcd "LDR:" ; Ldr ; " mV" Locate 2 , 1 : Lcd "Setpoint:" ; Setpoint ; " mV" Return '*************************************************************** Termostat: Setpoint_max = Setpoint Setpoint_min = Setpoint - 10 If Ldr > Setpoint_max Then If Countdown = 0 Then Reset Relay Countdown = 10 '10 x 300ms of Main Loop Waitms 300 ' End If : Set Relay Elseif Ldr <= Setpoint_min Then If Countdown = 0 Then Set Relay Countdown = 10 End If End If Return '*************************************************************** Control: If Countdown > 0 Then Decr Countdown If Countdown = 0 Then Toggle Relay End If Return '--------------------------------------------------------------- [/code:1:a02d0868cc]

BASCOM-ARDUINO : TFT 5inches, ssd1963 and Mega 2560 : REPLY

$
0
0
Hello, And bienvenue in this sub forum, As I said I show "the fantastic job and help of H. Kipnik . his code is perfect , fast , the use of SD card Touch screen is well done. " with his approval. If you look for a little bit in the rems on the head you'll find his mail address. but before look at to the file "ssd1963_function.inc" you will find the sub '------------------------------------------------------------------------------- ' set_window Set Window Area to write data '------------------------------------------------------------------------------- Sub Lcd_set_window(byval Xpos As Word , Byval Ypos As Word , Byval Xsize As Word , Byval Ysize As Word) Local X_add As Word , Y_add As Word Local Tem As Byte X_add = Xpos + Xsize Decr X_add Y_add = Ypos + Ysize Y_add = 480 - Y_add Ypos = 480 - Ypos Call Ssd1963_select_reg(set_column_address) Tem = High(xpos) Call Ssd1963_write_data(tem) Tem = Low(xpos) Call Ssd1963_write_data(tem) Tem = High(x_add) Call Ssd1963_write_data(tem) Tem = Low(x_add) Call Ssd1963_write_data(tem) Call Ssd1963_select_reg(set_page_address) Tem = High(y_add) 'ypos Call Ssd1963_write_data(tem) Tem = Low(y_add) Call Ssd1963_write_data(tem) Tem = High(ypos) 'yadd Call Ssd1963_write_data(tem) Tem = Low(ypos) Call Ssd1963_write_data(tem) Call Ssd1963_select_reg(write_data_to_gram) End Sub you can maybe play a with the XY pos let me know please JP

BASCOM-AVR : Olimex AVRISP MKII not working in Windows 7 : NEWTOPIC

$
0
0
Does not work with Bascom or Atmel Studio. On Windows XP , same hardware, its works. There I only installed the driver provided by Olimex. Seems to be only Libusb. On XP it is old version of libusb. On W7 he installs the newer version (I found on internet that this is necessary indeed). But it doesn't work: Timeout. This timeout-message comes from 'STK500v2' in W7. When I force timeout in XP (unplug USB) the timeout comes from usblib I guess. See screenshot. Don't find file STK500xx in driver map, nor in Bascom-map. [b:1b80a0f018][color=red:1b80a0f018](BASCOM-AVR version : 2.0.7.8 )[/b:1b80a0f018][/color:1b80a0f018]

BASCOM-AVR : Olimex AVRISP MKII not working in Windows 7 : REPLY

$
0
0
try a time out of 100 ms. also , try another USB port. you can also try to update the firmware of the mkII. I tested on Win7 without problems. There are however 2 different versions for the mkII : one for use with avr studio, and one for use with libusb (bascom, avrdude)

Share your working BASCOM-AVR code here : SIM 5215 and 5215 3G modules : NEWTOPIC

$
0
0
The short attached program shows how to interface an ATMega2560 chip with a SIM5216 3 G modem to send SMS and MMS messages. Later I will be adding the capability to take and transmit pictures as I have posted elsewhere on the forum for the SIM900. When this is done the resulting program will remain within the capabilities of the ATMega168. I only went to the ATMega2560 because I knew I would run out of I/O pins for other functions. This short program took many frustrating hours to work out and I found little help on the Internet so I hope this posting will save some folks at least some of my troubles. Contact information for me is included in the attachment. With the SIM900 I found that the installed firmware did not support MMS. This was not the case for the SIM5216. So far I have no problems with either the chip itself or the supporting documentation provided by SIMCom. I used a project board for the SIM5216 made by ITEAD. As noted in the attachment there is an error in the labeling of two power pins on the board.

BASCOM-AVR : libray for FT81x planned? : REPLY

$
0
0
Using the Ft800 now, very interested in Ft81x

BASCOM-AVR : Interrupts and power consumption : REPLY

$
0
0
Hi MadAl, It's hard to say what would be causing your problem without knowing the circuit you've connected and seeing your program. When you say 10-30mA is that just the processor or your whole circuit? Going by the data sheet(link below), the absolute maximum of the processor is 15mA normally 10mA with a 32MHz crystal. http://www.atmel.com/images/atmel-8362-8-and-16bit-avr-microcontroller-atxmega256a3bu_datasheet.pdf Maybe you should look at the consumptions of the items driven by the processor and what is turned on in the interrupts. Dean

BASCOM-AVR : Interrupts and power consumption : REPLY

$
0
0
Thanks for your reply. It so appears that the problem with the single program line I referred to in my question, is linked to something else (I have a hunch some externally connected SPI devices). Possibly (and very likely) this single line triggers some port states to change (something I will measure using a DMM) which will then either drive or sink current form the peripherals. I discovered this as after putting the ATxmega to sleep using an external 32.768 kHz crystal (using the RTC) the current was still up at 30 mA, so it definitely must be peripheral related. I will continue my quest by searching in the SPI maze. Time consuming for sure but hopefully rewarding in the end.

BASCOM-AVR : Olimex AVRISP MKII not working in Windows 7 : REPLY

$
0
0
I did a firmwareupdate of the MKII. The problem is solved. My previous project was in XP. For W7 and the new libusb you need more recent firmware. Case closed. Thanks for your suggestion.

BASCOM-ARDUINO : TFT 5inches, ssd1963 and Mega 2560 : REPLY

$
0
0
Thank you for responce. Yesterday I did display correct - in 2 line in code: Call Ssd1963_select_reg(&Hba) 'Gipo 3:0 out1 Call Ssd1963_write_data(&H01) '0f <----------------------- was 0f is 01 Call Ssd1963_select_reg(&Hb8) 'Gipo3=input Gipo2=output Gipo0=normal Call Ssd1963_write_data(&H07) '07 Call Ssd1963_write_data(&H01) ' !!!!!!!!!!!!!!!!!!!!!

New WebSite : Test : NEWTOPIC

New WebSite : New server - notice : NEWTOPIC

$
0
0
[b:0c10981e3c][i:0c10981e3c]We finally migrate our site to new server. In case if you get somewhere error (like 403 or so) please inform us about that at: tomi (at) mcselec (dot) com and please attach some detailed info where you get that error include URL, time and your IP (it is visible on error page). Thanks for understanding[/i:0c10981e3c][/b:0c10981e3c]

New WebSite : just test : NEWTOPIC

BASCOM-ARDUINO : TFT 5inches, ssd1963 and Mega 2560 : REPLY

$
0
0
On the other hand, if you can software control the backlight - enable, disable, lighten and darken?

BASCOM-AVR : libray for FT81x planned? : REPLY

$
0
0
I too use FT800 lib. ☺ This is no surprise to MCS since I took some minor part in the FT800...inc that Peter Maurodas and Mark struggled so hard with. I am saying this to incourage Bascom'ers to consider using ft800 In your products. Ft800 is extremely powerful and versatile. It is not just an ordinary display chip. It is a graphics engine that can provide amazing functions and unburden your AVR from tasks otherwise impossible. It is of course very hard for MCS to prioritize when not knowing who is using what libs. How can we help to give MCS an idea of the popularity of certain features of Bascom ? Perhaps a survey? MCS could issue one. The forum could also organize some statistics. How could this be done. By a moderator? Just an idea to make Bascom even better. Finally I want to send Christmas greetings to all of you. Keep programming and innovating. Merry Christmas to all. /Per

BASCOM-AVR : Interrupts and power consumption : REPLY

$
0
0
I can not make a stripped down version of my program as the problem does not occur then. In summary I define a couple of ports for chip select of SPI devices. Then I set these pins high to deselect all lines and the current jumps to 34 mA (11 mA is normal). First I though the SPI devices were taking the excessive current, but closer inspection of the ports using a DMM gave an interesting result. I measured the ports and discovered that they were all LOW except for one (despite being programmed to high). So I did a test: toggling these pins at a 1 sec interval, and now the voltages on these pins go high and low and (hold your seat), the current dropped to 11 mA. It gets even weirder: if I do a 'do-loop' and keep the pins set in the loop (no toggling), current drain is also 11 mA (OK). So in summary: setting 5 pins ‘high’ and then halting the program, some pins are not high but low and current is 34 mA setting the same pins high in a do-loop, the voltages on these pins are high and current drops to 11 mA It appears I have to rattle and shake these pins first before they respond :-O First a short code summary of where the issue starts occurring: [code:1:068c32476c]Config Portd.5 = Output Csalti Alias Portd.5 '------------------------------------------------------------------------------ Config Porta.1 = Output Cspitot Alias Porta.1 '------------------------------------------------------------------------------ Config Portc.1 = Output Csaccsel Alias Portc.1 '------------------------------------------------------------------------------ Config Portd.4 = Output Csflash Alias Portd.4 '------------------------------------------------------------------------------ Rfm26_nsel Alias Portc.4 Config Rfm26_nsel = Output Rfm26_shut_dn = 1 Power_sensors = 1 Csalti = 1 Cspitot = 1 Csaccsel = 1 Csflash = 1 Rfm26_nsel = 1 Do NOP Loop [/code:1:068c32476c] The above code gives 34 mA power consumption and 4 of the defined ports are physically at low level (although set to 1). Next experiment: toggling the ports in a loop: Do_ Rfm26_shut_dn = 1 Power_sensors = 1 Csalti = 1 Cspitot = 1 Csaccsel = 1 Csflash = 1 Rfm26_nsel = 1 waitms 1000 Rfm26_shut_dn = 0 Power_sensors = 0 Csalti = 0 Cspitot = 0 Csaccsel = 0 Csflash = 0 Rfm26_nsel = 0 waitms 1000 Loop This gives 11 mA power consumption (OK) and the voltage on the pins respond to the toggling The next examples also gave an OK 11 mA where the pins are not toggled but assigned in a loop nevertheless: [code:1:068c32476c]Do_ Rfm26_shut_dn = 1 Power_sensors = 1 Csalti = 1 Cspitot = 1 Csaccsel = 1 Csflash = 1 Rfm26_nsel = 1 waitms 1000 Loop [/code:1:068c32476c] or [code:1:068c32476c]Do_ Rfm26_shut_dn = 0 Power_sensors = 0 Csalti = 0 Cspitot = 0 Csaccsel = 0 Csflash = 0 Rfm26_nsel = 0 waitms 1000 Loop [/code:1:068c32476c] It would appear the interrupts are part of the game here, as if I do this, the problem disappears: [code:1:068c32476c]Disable interrupts Rfm26_shut_dn = 1 Power_sensors = 1 Csalti = 1 Cspitot = 1 Csaccsel = 1 Csflash = 1 Rfm26_nsel = 1 Do NOP Loop [/code:1:068c32476c] However if I do this, the problem is back, although the interrupts are disabled: [code:1:068c32476c]Rfm26_shut_dn = 1 Power_sensors = 1 Csalti = 1 Cspitot = 1 Csaccsel = 1 Csflash = 1 Rfm26_nsel = 1 Disable interrupts Do NOP Loop [/code:1:068c32476c]

BASCOM-AVR : Problem with USBASP and Bascom, can't identify the uC. : NEWTOPIC

$
0
0
Hi! I use the first time that nice option to program my ATtiny2313 with the USBASP programmer through Bascom but I run in a problem: Here is my code what I wish to upload to the uC. This code is just for practice, not a useful think. [code:1:12abeaee38] $regfile = "2313def.dat" $crystal = 8000000 $hwstack = 40 $swstack = 16 $framesize = 32 $baud = 19200 Dim A as integer Do Incr A Loop End [/code:1:12abeaee38] I configured in the option menu of Bascom to use the USBASP programmer. I press the F4 button and the programmer windows is visible. In the left upper corner is a label "Chip" after this are "???" If I pres to identify my uC which is in the development board and working correct I got message: "Detected Micro ATtiny2313 does not match the selected Micro AT90S2313" I have no option where to select the micro, or I didn't realize that? :-( How can I set up in the fuse bit settings the right external crystal frequency? In that list menu I do not have any frequencies written. Under the list box of Fusebit KLA987 I have only options Ext. Crystal Osc. but without frequency of the ext. crystal osc. How can I know which Ext. Crystal Osc. should I use? Thanks for any advice. [b:12abeaee38][color=red:12abeaee38](BASCOM-AVR version : 2.0.7.8 )[/b:12abeaee38][/color:12abeaee38]

BASCOM-AVR : Problem with USBASP and Bascom, can't identify the uC. : REPLY

$
0
0
For ATtiny2313 you must use ATtiny2313.DAT.

BASCOM-AVR : Problem with USBASP and Bascom, can't identify the uC. : REPLY

$
0
0
HuHUUUU! This is working! :-) Thanks. Any clue how to set the fusebits to use my external 8MHz crystal oscillator?
Viewing all 20717 articles
Browse latest View live


Latest Images

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