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

BASCOM Project Blog : Aluminium robot arm. : REPLY

$
0
0
Looks Gold :lol: But i think, you have to slow down speed, if you reach the endpoint

BASCOM Project Blog : Aluminium robot arm. : REPLY

$
0
0
I know. This is caused by too small transmission ratio. I don't want to change setup of timer1 which is my square wave generator. Servos should work as fast as possible (to avoid jittering), transmission ratio e.g. 1:20 would fit my needs the best. Unfortunatelly have 1:6 and changing microstepping (greater) also isn't good solution for so small transmission ratio since stepper have too weak holding position capability. Currently I'm working on changing this ratio.

BASCOM-AVR : What would be faster? SHIFTOUT or Soft SPI ? : NEWTOPIC

$
0
0
What would be faster? SHIFTOUT/SHIFTIN or Software SPI ? Processor is AtMega 328P @ 16Mhz [b:98b5d58853][color=red:98b5d58853](BASCOM-AVR version : 2.0.8.1 )[/b:98b5d58853][/color:98b5d58853]

BASCOM-AVR : What would be faster? SHIFTOUT or Soft SPI ? : REPLY

$
0
0
What do you want to drive with this?

BASCOM-AVR : What would be faster? SHIFTOUT or Soft SPI ? : REPLY

$
0
0
SPI with its SCK of fOsc/2 is faster. Overall speed is a function of serial IO and code to fetch or store corresponding data, while the latter can take up multiple times of the transfer. SPI still has advantages, as the integrated SPI unit does rx/tx on its own, while user code can do other stuff in the meantime. At fastest pace one byte takes 16 cpu clocks, If storing of data takes for example 100 cpu cycles, overall speed is rather slow.

BASCOM-AVR : Hard & Soft I2C : NEWTOPIC

$
0
0
Hello everyone, a consultation. Is it possible to use I2C hardware and I2C software as a master at the same time? I have an application in which the TWI is connected to an Oled screen but I also need to connect to an OEM device that works with I2c at low speed (<100Kz) and I would like to make the interfaces independent, is this possible? Thank you. [b:59cc4b3f18][color=red:59cc4b3f18](BASCOM-AVR version : 2.0.8.1 )[/b:59cc4b3f18][/color:59cc4b3f18]

BASCOM-AVR : mega16m1 + Config CANbusmode : NEWTOPIC

$
0
0
Hi! Does Bascom support CAN commands with ATmega16m1 ? (I know - there is a note at the Config Canbusmode help: "The CAN commands are intended for the AVR processor AT90CANXXX series"....) Best regard Andrej [b:7d23e91da6][color=red:7d23e91da6](BASCOM-AVR version : 2.0.8.1 )[/b:7d23e91da6][/color:7d23e91da6]

BASCOM-AVR : mega16m1 + Config CANbusmode : REPLY

$
0
0
that was before they started a new series. So yes these chips work too, or are supposed to work. there might be less mobs. consult the datasheet.

BASCOM-AVR : mega16m1 + Config CANbusmode : REPLY

$
0
0
Thanks for the answer. Best regards Andrej

BASCOM-AVR : I2C-MULTI Problem mit ATMEGA328PB und MCP79410 : NEWTOPIC

$
0
0
Hallo, wer kann helfen? Wegen eines Adresskonflikts auf dem I2C Bus, habe ich eine Lösung mit dem ATMEGA328PB versucht, scheitere aber an dem I2C_TWI_MULTI. Zunächst konfiguriere und initialisiere ich den I2C_TWI_MULTI - BUS (Bascom Beispiel): $lib "I2C_TWI-MULTI.lib" Config Scl = Portc.5 ' we need to provide the SCL pin name Config Sda = Portc.4 ' we need to provide the SDA pin name Config Sda1 = Porte.0 'use this for the second TWI Config Scl1 = Porte.1 Config Twi = 400000 Config Twi1 = 400000 Dim _i2cchannel As Byte ' you MUST dim this variable yourself when using the above lib I2cinit 'default TWI init I2cinit Twi1 'optional TWI1 to init that interface Nach Auswahl des jeweiligen Kanals mit _i2cchannel = 0 bzw. _i2cchannel = 1 werden alle Komponenten bis auf den Mcp79410 gefunden. I2cstart I2cwbyte I2C_address 'send address I2cstop If Err = 0 Then 'got ack Print "OK " Else Print "ERROR " End If OK - M24m02_1 -- &B1010_0000 'an _i2cchannel = 1 OK - M24m02_2 = &B1010_1000 'an _i2cchannel = 1 ERROR -- Mcp79410 'an _i2cchannel = 0 ERROR -- Mcp79410eeprom 'an _i2cchannel = 0 OK - HT16K33 -- &B1110_0000 ''an _i2cchannel = 0 Das Umschalten zwischen den I2C Kanälen funktioniert offensichtlich, nur der MCP79410 wird nicht gefunden. Zur Überprüfung der Verdrahtung und der Hardware habe ich mittels Software I2C die verschiedenen I2C – Bausteine separat angesprochen: '****** I²C bus ******* 'ONLY I2C hardware BUS $lib "I2C_TWI.Lbx" Config Sda = Portc.4 Config Scl = Portc.5 Config Twi = 400000 I2cinit '******** I2cstart I2cwbyte I2C_address 'send address I2cstop If Err = 0 Then 'got ack Print "OK " Else Print "ERROR " End If Das funktioniert ohne Probleme, die Komponenten an C.4 / C.5 antworten mit ACK OK -- Mcp79410 -- &B1101_1110 OK -- Mcp79410eeprom -- &B1010_1110 OK -- HT16K33 -- &B1110_0000 Aktiviere ich aber die Hardware I2C ($lib "I2C_TWI.lbx), dann erhalte ich nur noch von dem HT16K33 ein ACK, der RTC Baustein meldet sich nicht mehr. Starte ich den gleichen Versuch mit dem zweiten Software I2C an E.0 / E.1, dann antworten wie erwartet die Speicherbausteine M24M02-DR. OK - M24m02_1 -- &B1010_0000 OK - M24m02_2 = &B1010_1000 Zusammenfassend gesagt: Immer wenn mittels der entsprechenden .lbx auf HARDWARE I2C umgeschaltet wird, funktioniert der MCP79410 nicht mehr. Um den üblichen Rückfragen vorzubeugen: Nein, der Chip ist nicht defekt, ich habe zwei Exemplare probiert, das Problem bleibt bestehen. Nein, es wurden keine pull up Widerstände (4K7) vergessen. Nein, die Busgeschwindigkeit ist nicht zu hoch, ich habe auch Config Twi = 100000 probiert. Nein, die Leitungslänge ist nicht zu lang, sondern eher kurz, wobei der HT16K33 am weitesten entfernt ist, der MCP7941 sitzt nur etwa 3 cm vom Atmega entfernt. Der AtmegA328PB läuft mit dem internen Oszillator mit 8 Mhz. Eigentlich würde ich das Problem bei dem MCP79410 suchen, aber dieser funktioniert mit SOFTWARE I2C problemlos. Mein Gedanke ist nun, dass das Timing des HARDWARE I2C irgendwie kritisch ist. Mir steht momentan kein Oszi zur Verfügung, bei Gelegenheit werde ich aber versuchen das Timing zu überprüfen. Hat jemand eine Idee? Mache ich irgendwo einen (Denk-) Fehler. Kann man in der .lbx irgend etwas ändern? Kann man in den Registern des Atmega328PB irgendetwas anpassen? Vielen Dank für eure Mühe und das Gehirnschmalz [b:2778b08f2c][color=red:2778b08f2c](BASCOM-AVR version : 2.0.8.1 )[/b:2778b08f2c][/color:2778b08f2c]

BASCOM-AVR : Atmega 328p How reset by software ? : REPLY

$
0
0
Dear friends; Using if resetcommand = 1 then Wdtcsr = &B11111111 endif in my code it do a reset in about 2 seconds, but it will not start again unless repowering the device. I have wrote Wdtcsr = 0 in the begining of my code but it seems not work Have I miss some code ? I am using a bootloader Atmega328p

Share your working BASCOM-AVR code here : 2.8inch 65K FullColorLCD 240x320dot [ILI9341] : REPLY

$
0
0
Hello O-Family. I tryed to use this LCD display (IL9341) and probably I did't understand your instructions. After compile file I get an error message: Error : 5 Line : -2871 No more space for BIT [OFFSET256] , in File : C:_MS PROGRAMSBAS-AVRLIBGLCD-ILI9341_2R8_240X320.LIB Error : 320 Line : 185 [syntax error, token = '{'] , in File : C:_MS PROGRAMSBAS-AVRLIBGLCD-ILI9341_2R8_240X320.LIB Please would you be so kind and explane again, maybe more detail, what I have to do, that LCD will running. Where I have to change "Offset 256"? For test I took your example file. Different are only aliases for ports. I tryed this on ATMEGA328P and also ATXMEGA128 (using Virtual port), but error message is the same. Best regards M.

Share your working BASCOM-AVR code here : 2.8inch 65K FullColorLCD 240x320dot [ILI9341] : REPLY

$
0
0
Hi, The error has weird things. Error: 5 Line: -2871 No more space for BIT [OFFSET 256] I do not think that the line number of the error will be minus [-2871]. Error: 320 Line: 185 [syntax error, token = '{'] Error code [320] does not have its number in the BASCOM manual. This little information is difficult to solve. Is the latest version of BASCOM?

BASCOM-AVR : PCINT does not work on every input-pin : NEWTOPIC

$
0
0
Hello, I'm working on pin-change-interrupt to get SW-Uart to work. I'm encountering problems, so I stripped down the thing to the essenrtial. As you can seen, I achive to trigger PCINT on pulsed outputs, that makes it easier to set up the test. Every second I pulse out some OUTPUTS with delays, just to see things clearer. What I expect ist to trigger an PCINT by pulsing an output, which triggers the corresponding PCINT. It works fine if I pulse PINB.0. My issue: It does not work if I use PortB.1. Not shown here, but the same issue on PortB.2. No other pin tested. The pulsed outputs work, leds are connected. Only one of the remarked snippets is to unmark at a time, of course. It seems not to be that complex, what's wrong here? regards Marc [code:1:ddf45ed38d]$regfile = "m328pdef.dat" $crystal = 8000000 $hwstack = 120 $swstack = 120 $framesize = 120 $baud = 9600 '$prog &HFF , &HE2 , &HD7 , &HFD Dim Tick_1s As Bit Led_pwr Alias Portb.0 'Power-Led green Rel_ss Alias Portb.6 Led_ch4 Alias Portd.7 Config Pinb.0 = Output Config Pinb.1 = Output Config Pinb.2 = Output Config Pinb.6 = Output Config Pind.6 = Output Config Pind.7 = Output '**** Timer1 1s **** Const Timer1reload = 7812 Config Timer1 = Timer , Prescale = 1024 Load Timer1 , Timer1reload On Ovf1 Timer1_isr Enable Timer1 Start Timer1 Declare Sub Uart_in_service '#### this toggles Rel_ss in Uart_in_service ISR: 'Pcmsk0 = &B0000_0001 'On Pcint0 Uart_in_service 'Enable Pcint0 '#### This does not: 'Pcmsk0 = &B0000_0010 'On Pcint1 Uart_in_service 'Enable Pcint1 Enable Interrupts '**** Main Loop **** Do If Tick_1s = 1 Then Reset Tick_1s Pulseout Portd , 7 , 250000 Waitms 250 Pulseout Portb , 0 , 250000 Waitms 250 Pulseout Portb , 1 , 250000 Pulseout Portb , 2 , 250000 Pulseout Portd , 6 , 250000 End If Loop '**** Interrupt Routines **** Timer1_isr: Load Timer1 , Timer1reload Set Tick_1s Return Uart_in_service: Toggle Rel_ss Return[/code:1:ddf45ed38d] [b:ddf45ed38d][color=red:ddf45ed38d](BASCOM-AVR version : 2.0.8.1 )[/b:ddf45ed38d][/color:ddf45ed38d]

BASCOM-AVR : PCINT does not work on every input-pin : REPLY

$
0
0
[quote:831edf2c30="Arera"]It seems not to be that complex, what's wrong here? [code:1:831edf2c30]'#### This does not: 'Pcmsk0 = &B0000_0010 'On Pcint1 Uart_in_service 'Enable Pcint1[/code:1:831edf2c30][/quote:831edf2c30] If you understand how PCINT works, i.e. that any pin of one port, selected by PCMSK, triggers one PCINT-vector, then you understand what's wrong with your code.

BASCOM-AVR : PCINT does not work on every input-pin : REPLY

$
0
0
MWS, I got it. PCMSK0 relates to Pinb.[0...7]. ATMEGA328PU has 23 PINT-pins, masked by PCMSK0, PCMSK1, PCMSK2. Got that fron the datasheet bevore. What mislead me, is the fact, that bascom alowes to type PCINT23. PCINT24 is rejected. Thus I thougt bascom would to the right settings, if i use i.e. PCINT18. So what is [code:1:6bdad99d91]on PCINT18 isr18[/code:1:6bdad99d91] meant for?

BASCOM-AVR : PCINT does not work on every input-pin : REPLY

$
0
0
[quote:bec494b9d6="Arera"] So what is [code:1:bec494b9d6]on PCINT18 isr18[/code:1:bec494b9d6] meant for?[/quote:bec494b9d6] This symbol abuse means nothing. Only because you can type [b:bec494b9d6]frzgblrmfogl[/b:bec494b9d6] , it does not mean anybody understands it. The symbols PCINT18, PCINT19, a.s.o. exist because they describe the PC-interrupt pins according the data sheet, thus it is valid to write: [code:1:bec494b9d6]PCMSK2.PCINT18 = 1[/code:1:bec494b9d6] for enabling PCINT18-pin (PD2) to trigger vector PCINT2.

BASCOM-AVR : PCINT does not work on every input-pin : REPLY

$
0
0
OK. Got it. In difference to "sjgfjhasgfuzawgu" (will not be compiled), "ON PCINT18 my_ISR" will compile. That lead my to assume that this is a valid Interrupt. That lead me to use PCINT1, expecting to Interrupt on PCINT1 (pinb.1). "on gfgfjdjdhdhz my_ISR" will not compile too, enforcing my erroneous assumption. Thank you, MWS! Marc

Share your working BASCOM-AVR code here : 2.8inch 65K FullColorLCD 240x320dot [ILI9341] : REPLY

$
0
0
Hello. I use version of Bascom 2.0.8.1. I fixed a problem. On ATMEGA328PU after a combination of pins start work. I forget to make [code:1:260cb7ecf0]Dim Offset256 As Byte[/code:1:260cb7ecf0] On XMEGA128A3 I have still problem. (something with VPORT) Thank you and Best regards. M.

Share your working BASCOM-AVR code here : 2.8inch 65K FullColorLCD 240x320dot [ILI9341] : REPLY

$
0
0
You said the same error would occur in my sample code, so deleting [Dim Offset 256 As Byte] did not give the error you presented. This library has been modified for the ST7735R, so it will be solved if you check the thread corresponding to the ST7735R XMEGA.
Viewing all 20553 articles
Browse latest View live


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