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

BASCOM-AVR : RFID Reader : REPLY

$
0
0
...Page is in German, but there are links to Raspberry C Code and others... http://regnerischernachmittag.wordpress.com/2013/08/03/5euro-rfidnfc-modul-rc522-zum-auslesen-von-mifare-tags/

BASCOM-AVR : RFID Reader : REPLY

$
0
0
the module sl30 has code included : http://www.stronglink-rfid.com/download/SampleCode/SL030/AVR-SL030.zip it should be fairly simple to translate it. if have no module but it would not take more than an hour to convert it to bascom.

BASCOM-AVR : xmega ADC-DMA problem : NEWTOPIC

$
0
0
The code was written according to the samples of Bascom 2.0.7.7 for Xmega based on a sample AD_Free_run_1_channel_8-bit_mode + one DMA Channel.bas. But this code works only once (J=1). What I need to do for the Sub Get_adc() restarting ? [code:1:0d280530c4]$regfile = "xm128a4udef.dat" $crystal = 32000000 '32MHz $hwstack = 64 $swstack = 40 $framesize = 40 Config Osc = Enabled , 32mhzosc = Enabled , Plldiv2 = Enabled Config Sysclock = 32mhz '--> 32MHz Config Com5 = 57600 , Mode = Asynchroneous , Parity = None , Stopbits = 1 , Databits = 8 Open "COM5:" For Binary As #1 'Config Eeprom = Mapped 'when using EEPROM , add this config command '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Const Sample_count = 1500 'Number of 12-Bit Samples (Measurement Values) '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Dim Channel_0(sample_count) As Integer 'Measurement Array for Channel 0 Dim Dma_ready As Bit Dim Dma_channel_0_error As Bit Dim X As Word , J As Byte Declare Sub Get_adc() ' DMA Interrupt On Dma_ch0 Dma_ch0_int 'Interrupt will be enabled with Tci = XX in Config DMAX Config Dma = Enabled , Doublebuf = Disabled , Cpm = Ch01rr23 ' enable DMA, Double Buffer disabled Config Priority = Static , Vector = Application , Lo = Enabled ' DMA Channel 0 is used here Config Dmach0 = Enabled , Burstlen = 2 , Chanrpt = Enabled , Tci = Lo , Eil = Lo , Singleshot = Enabled , _ Sar = Burst , Sam = Inc , Dar = None , Dam = Inc , Trigger = &H10 , Btc = 3000 , Repeat = 1 , Sadr = Varptr(adca_ch0_res) , Dadr = Varptr(channel_0(1)) ' We use DMA Channel 0 ' Burstlen = 2 (We use here 12-Bit Mode so we need 2Bytes from Source Address = ADC A) ' Channelrepeat is enabled ' BTC = 2000 (must be 2X of Sample_count because of 2 Bytes per Measurement Value) ' TCI = Lo --> Low Level Transaction Complete Interrupt is enabled ' EIL = Lo --> Low Level Error Interrupt is enabled ' Sar = Source Address reloaded after each burst ' Sam = incremented (Low Byte and High Byte of Measurement Value) ' Dar = No Destination address reload ' Dam = inc (Destination Address (the Array) will be incremented by one) ' Trigger (Trigger base value for ADC A = &H10 + Trigger offset = &H00 for Channel 0 --> &H10 ) 'Configure ADC of Port A in FREE running mode Config Adca = Free , Convmode = Signed , Resolution = 12bit , Dma = Ch01 , _ Reference = Int1v , Event_mode = None , Prescaler = 16 , Sweep = Ch0 , _ Ch0_gain = 2 , Ch0_inp = Diffwgain , Mux0 = &B00000000 Enable Interrupts For J = 1 To 5 Call Get_adc() For X = 1 To Sample_count Print #1 , Channel_0(x) ; " "; Next X Print #1, Print #1 , "J=" ; J Reset Dma_ready Set Adca_ctrlb.3 Set Adca_ctrla.0 Next J End 'end program '************************************************* Sub Get_adc() '************************************************* Do Loop Until Dma_ready = 1 'Disable Channel 0 Interrupt on comversion complete Adca_ch0_intctrl = &B0000_00_00 'OFF Int on Conversion complete (CH 0) 'Disable Free Running mode Reset Adca_ctrlb.3 'Disable ADC A Reset Adca_ctrla.0 End Sub '----------------------[Interrupt Service Routines]----------------------------- ' Dma_ch0_int is for DMA Channel ERROR Interrupt A N D for TRANSACTION COMPLETE Interrupt ' Which Interrupt fired must be checked in Interrupt Service Routine Dma_ch0_int: If Dma_intflags.0 = 1 Then 'Channel 0 Transaction Interrupt Flag Set Dma_intflags.0 'Clear the Channel 0 Transaction Complete flag Set Dma_ready End If If Dma_intflags.4 = 1 Then 'Channel 0 ERROR Flag Set Dma_intflags.4 'Clear the flag Set Dma_channel_0_error 'Channel 0 Error End If Return[/code:1:0d280530c4] Help me please. [b:0d280530c4][color=red:0d280530c4](BASCOM-AVR version : 2.0.7.7 )[/b:0d280530c4][/color:0d280530c4]

EASY TCP/IP : Ethernet Bootloader for Easy TCP/IP : REPLY

$
0
0
Hi Mark and welcome! I'm afraid there is no simple answer, that why there is no response yet. I got an ethernet bootloader running, but you cannot just copy it, unless you use -WIZ820IO module -ATmega1284 -external EEPROM 24A1025 BTW it would take me hours to strip down my prog to leave only the BL part. Here's how it works: A little proggy on a PC loads up the .hex file to the ATmega1284 line by line. Data of each line is stored away to the EEPROM. Then the bootloader is started and writes data from the external EEPROM to the megas flash. Marc

BASCOM-AVR : RFID Reader : REPLY

$
0
0
Hi, That's what I'm seeing at the moment. Although I've not spent much time working on mine the documentation that I've read isn't the best. Regards Ian Dobson

BASCOM-AVR : RFID Reader : REPLY

$
0
0
If you mean datasheet of RC522 i think it's really somewhat ... funny. It doesn't explain many functions this chip has so it's hard to configure it, and there's no sample initializaton procedure in datasheet. So, i think that only possibility is that you know C language and translate one of C examples, since there are easy to find. I really hope that you will be succesfull in Bascom, Ian!

BASCOM-AVR : Uart0 RX pin must have a resistor connected to GND to work : REPLY

$
0
0
Hello njepsen, I use Atmega2560. Like i said i have on the RX0 a 1k in serie with a led and it works. If i remove the led or the 1k what is the same the uart0 not receive anymore and the Watchdog that i config with 1024 reset the micro. Tomorrow i wil make the test that you indicate and will give Feedback Thank you Best regards toto

BASCOM-AVR : Atmega2560 : NEWTOPIC

$
0
0
Hello, Anyone have used Atmega2560 and want share problems that can happens using this device? or anything that must take care about a design with this micro? Thanks in advance toto [b:6d27346967][color=red:6d27346967](BASCOM-AVR version : 2.0.7.7 , Latest : 2.0.7.7 )[/b:6d27346967][/color:6d27346967]

Share your working BASCOM-AVR code here : MAX31855 Thermocouple : NEWTOPIC

$
0
0
Hi, This simple example of reading the MAX31855. Is similar of MAX6675 but, run only in 3V3, in 14 bit and very lower cost. This example is tested whit thermocouple K and MAX31855KASA+ I have used external Quartz and 10nF capacitor on thermocouple leads for reduce the enviroment noise. [code:1:17aa32d4d2] $regfile = "m88def.dat" $crystal = 8000000 $baud = 9600 $hwstack = 40 $swstack = 30 $framesize = 40 ' Config Config Portc.1 = Output ' CS Config Portc.0 = Output ' SCK Config Portc.2 = Input ' S0 ' Alias Cs Alias Portc.1 Sck Alias Portc.0 So Alias Pinc.2 ' Deflault Values Set Cs ' CS1 to Hight Reset Sck ' CSK low Set So ' SO hight Declare Function Get_ext_temperature() As String * 5 Dim Tmp1 As Dword ' 32 bit var Dim Tmp2 As Word ' 16 bit var Do Print "Thermocouple: " ; Get_ext_temperature() Waitms 750 Loop Function Get_ext_temperature() As String * 5 ' TC temperature Reset Cs ' CS1 to low Shiftin So , Sck , Tmp1 , 0 , 32 ' Read 32 bit data from max33855 Set Cs ' CS1 to Hight If Tmp1.0 = 1 Then ' tmp1.0 = 1 = no sensor Get_ext_temperature = "NO_TC" Exit Function Elseif Tmp1.1 = 1 Then ' tmp1.1 = 1 = short circuit to gnd Get_ext_temperature = "SCGND" Exit Function Elseif Tmp1.2 = 1 Then ' tmp1.2 = 1 = short circuit to vcc Get_ext_temperature = "SCVCC" Exit Function Elseif Tmp1.17 = 1 Then Get_ext_temperature = "FAULT" ' 1 if SCV,SCG or OC fault End If Shift Tmp1 , Right , 18 ' Move D0-D17 now the D18-D31 at LSB of tmp1 Tmp2 = Tmp1 ' Cut for 16bit If Tmp2.13 = 0 Then ' tmp2.0 to tmp2.12 = value, tmp2.13 = sign 0=+ 1=- Get_ext_temperature = "+" ' tmp2.14 and .15 is allways 0 Else Get_ext_temperature = "-" Tmp2.13 = 0 End If Tmp2 = Tmp2 / 4 ' for convert to celsius Get_ext_temperature = Get_ext_temperature + Str(tmp2) End Function [/code:1:17aa32d4d2]

BASCOM-AVR : Question about programming : NEWTOPIC

$
0
0
Hello I would like programm a chip via serial using max232 something like this: http://cdn.webdca.com/avr/images/programmers/max-232.png The problem is that i don't how what settings should i use for the programmer type and comunication Please help [b:37c29f939c][color=red:37c29f939c](BASCOM-AVR version : 2.0.7.7 )[/b:37c29f939c][/color:37c29f939c]

BASCOM-AVR : Question about programming : REPLY

$
0
0
Search for bootloader in this forum. in short: the first time you have to program a small part of the flash with a bootloader. With fusebits you tell the avr to jump first to the bootloader and if nothing comes in on the serial port jump to the start of your program. in Bascom there are commands to not overwrite this boot-area. have fun Ben Zijlstra

BASCOM-AVR : Atmega2560 : REPLY

$
0
0
Perhaps you can share your problems in this forum. Have used the Arduino Mega 2560 without any problems. But remembered there were problems in the past while crossing 64 k boundries on the atmega128. have fun Ben Zijlstra

Share your working BASCOM-AVR code here : MAX31855 Thermocouple : REPLY

$
0
0
Thanks for sharing! Have fun Ben Zijlstra

Share your working BASCOM-AVR code here : MAX31855 Thermocouple : REPLY

$
0
0
Nice!!! Thanks for the example!!!

BASCOM-AVR : Atmega2560 : REPLY

$
0
0
Hello Ben, I know you have a lot of experience and will hope you can help me. Long time I have problems in a project in there I use the ATmega2560 Use the COM0 for RS485, baud 38400, 1 master and <= 35 slaves. Works perfectly in the laboratory during a lot of months 24 hours a day. The actual application run in a noisy environment where we have AC motor and frequency inverter that controls the movement of the motor. Without apparent reason from time to time, the ATmega2560 resets by Watchdog. Use the Bascom 2.0.7.7 and RS485 communication with the RX0 and "INPUTBIN". As I read, the InputBin waits until it receives all expected bytes, thought the electric noise the InputBin would be frozen, waiting for the data and Reset the micro. I have a 1024 Watchdog. So, I modified the program to "INKEY" that get byte by byte and as such according to the Bascom Help it should not be frozen. In the laboratory continues to work very well. with this version. I placed a Reset Watchdog in the Main Loop, why should not stay frozen for RS485 communication. To my amazement, the test of this Inkey version was horrible in the noisy environments, almost nothing works, it always reset the micro. It should be not, because it was changed to InputBin inkey. Another strange thing is that the INPUTBIN version required on pin RX0 a resistor of 1K to GND. Without the resistor, the micro is doing constantly Reset by Watchdog. The version with "INKEY" not need the 1k resistor, communication works without it. This leads me to believe that Bascom treats differently both forms of communication. I read that in some Atmegas http://www.avrfreaks.net/index.php?name=PNphpBB2&file=printview&t=107115&start=0 RX0 may cause the crash. I added a filter with resistor 10k and 100pF between the RX0 and remove the 1k resistor on the INPUTBIN version, in hope that work without the resistor, but the micro continue Reset by Watchdog. If someone has an idea and can help I am grateful. Now I started to draw a new multilayer pcb to see if it solves the problem. Best regards toto

BASCOM-AVR : Atmega2560 : REPLY

$
0
0
Hi, Are you sure the problem is really a software problem and not a hardware problem. Frequency converts are notorious EMV bombs (I had lots of problems with a standard Microprocessor based system when the frequency converters close to the PCB ran at almost full speed. My solution was to install the microprocessor in a metal box with the case connected to ground). Also make sure you use shielded cables for you serial network. Show us the code. Using inputbin/inkey shouldn't make any real difference, also maybe try testing a minimal program that just reads from the RS485 network and dumps to a second serial port. Also what RS485 driver chip are you using? Regards Ian Dobson

BASCOM-AVR : Atmega2560 : REPLY

$
0
0
Hello, I use MAX487CSA+ as RS485 device Regards toto

BASCOM-AVR : How to program for >1 PCINT? : NEWTOPIC

$
0
0
Hello all, I am currently using Pin Change Interrupt 1 [code:1:90d0624772] Pcmsk0 = &B00000010 'set mask for port pin used On Pcint0 Isr_tamper Enable Pcint0 [/code:1:90d0624772] Now I need to use another PCINT0. I think the Pcmsk0 code would be : Pcmsk0 = &B00000011 'set mask for port pin used But how to program when the even occurs - since it could be either? Tim [b:90d0624772][color=red:90d0624772](BASCOM-AVR version : 2.0.7.7 )[/b:90d0624772][/color:90d0624772]

BASCOM-AVR : Eram : NEWTOPIC

$
0
0
Hi Can someone please tell me if it takes the same amount of time to read from an eram variable than from ram variable? Best regards Øyvind [b:663ba1a309][color=red:663ba1a309](BASCOM-AVR version : 2.0.7.7 )[/b:663ba1a309][/color:663ba1a309]

BASCOM-AVR : How to program for >1 PCINT? : REPLY

$
0
0
You have to check in your isr what pin it was by reading the PIN register and also if it was an rising or falling int.
Viewing all 21191 articles
Browse latest View live


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