Main Menu
Counter
This page today ...
total: 1
unique: 1

This page ever ...
total: 168
unique: 139

Site ...
total: 5783
unique: 3668
Online
  • Guests: 3
  • Members: 0
  • Newest Member: Kimmi
  • Most ever online: 170
    Guests: 170, Members: 0 on 15 Jan 2023 : 07:39
Chatbox
You must be logged in to post comments on this site - please either log in from the Login box or from here.


bullet Kim
9 years ago
test
Royalsystems blog

MCS Electronics Forum

  • BASCOM-AVR : Passing String to Sub ByStack : REPLY



    The fact that you do not get an error message is a bug. Originally this BYSTACK was not intended to be published. But when we did i forgot to review the code. I just did so and added an error.
    String and double are not supported. It is inefficient to pass them by stack, for a string the address could be passed but that is not the purpose of BYSTACK which was primarily added for the FT display code.

  • BASCOM-AVR : Passing String to Sub ByStack : NEWTOPIC



    Hello

    I try to pass a String to a Sub Routine [b:5f34d05714]ByStack[/b:5f34d05714].
    But No chars, no Pointer ist passed to the Softstack.

    The Soft-Stack-Pointer will not changed by calling the sub.

    In the Help is no Info, that a String can not passed ByStack.
    And The Compiler does not create a Error.

    It seems, the String will be ignored by Pushing to SoftStack.
    All other Variable types are working fine.

    Is this ab Bug or a Feature?

    Here my Text-Code:


    [code:1:5f34d05714]

    ' Test ByStack with String

    $Regfile = "m328pdef.dat"
    $HWStack = 64
    $SWStack = 64
    $Framesize = 64

    $Crystal = 8000000

    Config SubMode = new

    Dim myString as String * 30


    Sub TestByStack(ByStack txt as String )
    !LDD r20,y+0 ' no Letter
    !LDD r21,y+1 ' no Letter
    !LDD r21,y+2 ' no Letter
    !LDD r21,y+3 ' no Letter
    End Sub

    Break

    Do
    myString = "Hello World"
    Call TestByStack(myString )
    Call TestByStack( "Hello World" )
    Loop

    [/code:1:5f34d05714]

    [b:5f34d05714][color=red:5f34d05714](BASCOM-AVR version : 2.0.8.7 )[/b:5f34d05714][/color:5f34d05714]

  • BASCOM-AVR : 3 ssd1306 lib , how to choice ? : REPLY



    Hi Jarek

    Many thanks for your fast help.
    jp :wink:

  • BASCOM-AVR : Enum : REPLY



    Enum is not supported and what i do is using constants with a gap :
    const Something10 = 10
    const SOmething20=20
    now i can simply insert 9 other values.
    I use this in all my coding. Enum was not in QB and only late introduced in VB so i never missed/used it.
    But i fully agree that it is a usable extension of the language.
    If someone like to fund it i can add it but i guess it is not that important.

  • BASCOM-AVR : Enum : NEWTOPIC



    I have a few places where an enumerated value would be helpful.

    For example in a list of menus to be displayed I would, in C, use an enum so that inserting a new menu screen would be easy.

    Is there a clever way to do that in Bascom?

    [b:e45bdff598][color=red:e45bdff598](BASCOM-AVR version : 2.0.8.7 )[/b:e45bdff598][/color:e45bdff598]

  • BASCOM-AVR : 3 ssd1306 lib , how to choice ? : REPLY



    You must declare these variables:

    [code:1:2b4ba6f007]Dim Twi_start As Byte
    dim i2c_addr as byte[/code:1:2b4ba6f007]


    [u:2b4ba6f007]https://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&t=14297&postdays=0&postorder=asc&highlight=ssd1306&start=0[/u:2b4ba6f007]

    [u:2b4ba6f007]https://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&t=15212&highlight=ssd1306[/u:2b4ba6f007]

  • BASCOM-AVR : 3 ssd1306 lib , how to choice ? : NEWTOPIC



    Hi
    Maybe a question for O'Family :wink:

    I wrote a small program to display the temperature from a BME280 sensor on a small SSD1306 display.
    The program works very well.

    [img:e554a84e4d]https://www.mcselec.com/userpix/115_P10506837_1.jpg[/img:e554a84e4d]

    From the wide range of available libraries, I chose "glcdSSD1306-I2C.lib".
    The second one, "glcdSSD1306-I2C-TWI.lib", works too.
    However, the third one, "glcdSSD1306-I2C_V2x2.lib", produces errors.

    Error : 5 Line : -3327 No more space for BIT [I2C_ADDR] , in File : C:MCSBASCAVR2087LIBGLCDSSD1306-I2C_V2X2.LIB
    Error : 5 Line : -3327 No more space for BIT [I2C_ADDR] , in File : C:MCSBASCAVR2087LIBGLCDSSD1306-I2C_V2X2.LIB
    Error : 5 Line : -3327 No more space for BIT [_CONTRAST] , in File : C:MCSBASCAVR2087LIBGLCDSSD1306-I2C_V2X2.LIB
    Error : 5 Line : -3327 No more space for BIT [I2C_ADDR] , in File : C:MCSBASCAVR2087LIBGLCDSSD1306-I2C_V2X2.LIB
    Error : 5 Line : -3327 No more space for BIT [I2C_ADDR] , in File : C:MCSBASCAVR2087LIBGLCDSSD1306-I2C_V2X2.LIB
    Error : 5 Line : -3327 No more space for BIT [I2C_ADDR] , in File : C:MCSBASCAVR2087LIBGLCDSSD1306-I2C_V2X2.LIB
    Error : 5 Line : -3327 No more space for BIT [I2C_ADDR] , in File : C:MCSBASCAVR2087LIBGLCDSSD1306-I2C_V2X2.LIB

    [code:1:e554a84e4d]
    '-----------Microcontroleur------------------------------------------------------------------------------------------------
    $regfile = "m328pdef.dat"
    $crystal = 1000000
    $hwstack = 40
    $swstack = 40
    $framesize = 40

    'C.5 SCL
    'C.4 SDA
    'C.3 int 11
    'C.6 réservé au reset

    Config Submode = New
    'Debug On ' if you debug off you remove all print from USB port
    Const Updateeprom = 1
    Const Slave = &HEC ' bme280

    $include "mesures ssd.inc"
    '---- config------------------------------------------------------------------------------------------------------------------
    Config Clockdiv = 8

    '-------------------------------- I2C bus --------------------------------------------------------------------------
    Config Sda = Portc.4
    Config Scl = Portc.5

    I2cinit
    'I2cinit Twi
    'display---------------------------------------------------------------------------------------------------------------------

    $lib "glcdSSD1306-I2C.lib"
    '$lib "glcdSSD1306-I2C-TWI.lib"
    '$lib "glcdSSD1306-I2C_V2x2.lib"
    Config Graphlcd = Custom , Cols = 128 , Rows = 64 , Lcdname = "SSD1306"
    Dim Lcd_auto As Byte
    Lcd_auto = 1[/code:1:e554a84e4d]

    I try also with 8 mhz speed.

    many thanks for your help
    JP :wink:

    [b:e554a84e4d][color=red:e554a84e4d](BASCOM-AVR version : 2.0.8.7 )[/b:e554a84e4d][/color:e554a84e4d]

  • BASCOM-AVR XTINY/MEGAX/AVRX : xtiny ADC latest syntax? : REPLY



    [quote:654270321f="Duval JP"]hi,
    maybe my post is stupid
    [quote:654270321f] but even the samples give error when try to compile them[/quote:654270321f]

    I try to compile the sample adc.bas with axtiny816 and it is ok

    Did you buy and install the add-on?[img:654270321f]https://www.mcselec.com/userpix/115_20260727_194148_1.jpg[/img:654270321f]

    jp :wink:[/quote:654270321f]

    Hi JP,

    Of course i buyed&installed.
    In my pc it give errors (still win10) - but it is good idea to try on another pc.

    Laszlo

  • BASCOM-AVR XTINY/MEGAX/AVRX : xtiny ADC latest syntax? : REPLY



    hi,
    maybe my post is stupid
    [quote:e93aaaa853] but even the samples give error when try to compile them[/quote:e93aaaa853]

    I try to compile the sample adc.bas with axtiny816 and it is ok

    Did you buy and install the add-on?[img:e93aaaa853]https://www.mcselec.com/userpix/115_20260727_194148_1.jpg[/img:e93aaaa853]

    jp :wink:

  • BASCOM-AVR XTINY/MEGAX/AVRX : xtiny ADC latest syntax? : REPLY



    [quote:28b5c8af7a="ok1hdu"]I don't have an Attiny816 here so I can't check it, so no guarantees, however:
    The correct syntax for setting Sysclock is:[code:1:28b5c8af7a]
    Config Sysclock = 16_20mhz , Prescale = 1[/code:1:28b5c8af7a]
    Then it should work:[code:1:28b5c8af7a]
    W = Getadc(5) : Print "W:" ; W[/code:1:28b5c8af7a]

    Jarda[/quote:28b5c8af7a]

    Thanks for your reply and sorry about my late response.

    This config working today (with bascom 2.0.8.0.003) with another type ATtiny:
    [code:1:28b5c8af7a]'-------------------------------------------------------------------------------
    ' ATtiny402 ADC Dual-Channel Sampling Demo
    ' Function: Continuous sampling and channel switching between AIN6 and AIN7
    '-------------------------------------------------------------------------------
    $regfile = "atxtiny402.dat" ' Microcontroller definition file
    $crystal = 20000000 ' System clock speed: 20 MHz

    $hwstack = 48 ' Hardware stack size allocation
    $swstack = 48 ' Software stack size allocation
    $framesize = 48 ' Frame size allocation

    '--- Clock Configuration (20 MHz) ---
    Config Sysclock = 20mhz , Prescale = 1 ' Set system clock to 20MHz without prescaling

    '--- Port Setup ---
    Config Porta.6 = Input ' Set PA6 (AIN6) as input pin
    Config Porta.7 = Input ' Set PA7 (AIN7) as input pin

    '--- ADC Configuration (1.1V Internal Reference, 10-bit) ---
    Vref_ctrla = &B00010000 ' REFSEL=10: Select 1.1V internal reference

    Adc0_ctrlc = &B00000011 ' SAMPCAP= on, Prescaler 0 to 8 = div2/4/8/16/32/64/128/256
    Adc0_ctrlb = &B00000100 ' Sampnum 0 to 6 = none,2,4,8,16,32,64 sample
    Adc0_ctrla = &B00000011 ' RESSEL=0 (10-bit resolution), FREERUN=1, ENABLE=1

    ' Disable digital input buffers on analog pins as per datasheet recommendation
    Porta_pin6ctrl = Porta_pin6ctrl And &B11111000 ' Clear the lowest 3 ISC bits on PA6
    Porta_pin6ctrl = Porta_pin6ctrl Or &B00000111 ' Set INPUT_DISABLE (7) on PA6
    Porta_pin7ctrl = Porta_pin7ctrl And &B11111000 ' Clear the lowest 3 ISC bits on PA7
    Porta_pin7ctrl = Porta_pin7ctrl Or &B00000111 ' Set INPUT_DISABLE (7) on PA7

    '--- Variables ---
    Dim Adc_val_ch6 As Word ' Measured ADC value for AIN6
    Dim Adc_val_ch7 As Word ' Measured ADC value for AIN7
    Dim Current_channel As Byte ' Current active MUX channel ID

    '--- ADC Initial Kick-off ---
    Adc0_muxpos = 6 ' Set initial analog channel to AIN6
    Adc0_command = 1 ' Start first conversion in Free-Running mode

    '--- Main Loop ---
    Do

    ' Read current MUX channel ID
    Current_channel = Adc0_muxpos And &B00011111 ' Mask out channel bits

    ' Channel switching logic with Free-Running correction
    If Current_channel = 6 Then
    Adc0_muxpos = 7 ' Switch target channel to AIN7
    Bitwait Adc0_intflags.0 , Set ' Wait for previous conversion completion
    Adc0_intflags.0 = 1 ' Clear interrupt flag
    Adc_val_ch6 = Adc0_res ' Save converted result for AIN6
    'Print Adc_val_ch6 ' Print value
    Bitwait Adc0_intflags.0 , Set ' Wait for fresh conversion on new channel
    Adc0_intflags.0 = 1 ' Clear interrupt flag
    Adc_val_ch6 = Adc0_res ' Read stabilized result for AIN6
    Else
    Adc0_muxpos = 6 ' Switch target channel to AIN6
    Bitwait Adc0_intflags.0 , Set ' Wait for previous conversion completion
    Adc0_intflags.0 = 1 ' Clear interrupt flag
    Adc_val_ch7 = Adc0_res ' Save converted result for AIN7
    'Print Adc_val_ch7 ' Print value
    Bitwait Adc0_intflags.0 , Set ' Wait for fresh conversion on new channel
    Adc0_intflags.0 = 1 ' Clear interrupt flag
    Adc_val_ch7 = Adc0_res ' Read stabilized result for AIN7
    End If

    Loop[/code:1:28b5c8af7a]

| Date published: not known
Back to newsfeed list
Welcome
Username or Email:

Password:




[ ]
[ ]
Headlines

»BASCOM-AVR : Passing String to Sub ByStack : REPLY
The fact that you do not get an error message is a bug. Originally this BYSTACK was not intended to be published. But when we did...
»BASCOM-AVR : Passing String to Sub ByStack : NEWTOPIC
Hello I try to pass a String to a Sub Routine [b:5f34d05714]ByStack[/b:5f34d05714]. But No chars, no Pointer ist passed to the...
»BASCOM-AVR : 3 ssd1306 lib , how to choice ? : REPLY
Hi Jarek Many thanks for your fast help. jp :wink:
»BASCOM-AVR : Enum : REPLY
Enum is not supported and what i do is using constants with a gap : const Something10 = 10 const SOmething20=20 now i can simpl...
»BASCOM-AVR : Enum : NEWTOPIC
I have a few places where an enumerated value would be helpful. For example in a list of menus to be displayed I would, in C, u...
»BASCOM-AVR : 3 ssd1306 lib , how to choice ? : REPLY
You must declare these variables: [code:1:2b4ba6f007]Dim Twi_start As Byte dim i2c_addr as byte[/code:1:2b4ba6f007] [u:2b...
»BASCOM-AVR : 3 ssd1306 lib , how to choice ? : NEWTOPIC
Hi Maybe a question for O'Family :wink: I wrote a small program to display the temperature from a BME280 sensor on a small S...
»BASCOM-AVR XTINY/MEGAX/AVRX : xtiny ADC latest syntax? : REPLY
[quote:654270321f="Duval JP"]hi, maybe my post is stupid [quote:654270321f] but even the samples give error when try to compile...
»BASCOM-AVR XTINY/MEGAX/AVRX : xtiny ADC latest syntax? : REPLY
hi, maybe my post is stupid [quote:e93aaaa853] but even the samples give error when try to compile them[/quote:e93aaaa853] I...
»BASCOM-AVR XTINY/MEGAX/AVRX : xtiny ADC latest syntax? : REPLY
[quote:28b5c8af7a="ok1hdu"]I don't have an Attiny816 here so I can't check it, so no guarantees, however: The correct syntax for ...


Date published: not known
Details

»Funk-Fernbedienung 6 Kanal bidirektional
hallo Leute, ich möchte Euch ein Projekt aus meiner Bascom Anfangszeit (2023) vorstellen. eine 6 Kanal Funkfernsteuerung mit bidirektionaler Datenü...
»CRC16 mag nicht
Eine KI hat mir diesen Vorschlag erstellt um die Checksumme zu berechnen BASCOM-Quellcode (76 Zeilen)Das läuft nicht, es kommen Fehlermeldungen M...
»Feuchtesensor
Hallo, ich hab solche 'Schätzeisen' im Einsatz, die zeigen im Boden sonst was. Während es auf dem Tisch sauber, wiederholbar unterscheiden konnte o...
»Terminalplatine mobil
Bislang hatte ich meine Terminalplatine ( Atmega 328 mit Display und Eingabetastatur) immer nur in Schaltschränken oder ortsfesten Gehäusen eingese...
»OLED 1,5" 128x128 SH1107
habe mir aus China OLED-Display besorgt: 1,5 Zoll 128x128 Pixel , Treiber angeblich SH1107 leider gibt es dafür in Bascom-AVR keine Library. meine ...
»Hdmi Microskop
Wie das im Leben so ist, mit jeden Geburtstag gehs mit den Augen weiter bergab. Hat jemand eine HDMI Kamera bzw Microskop in Betrieb? Grad das HDMI...


Date published: Tue, 04 Aug 2026 11:57:14 +0000
Details

»4 January 20244 January 2024
»93c46 editor programmer bascom & vb93c46 editor programmer bascom & vb
»93c46 Bascom & VB693c46 Bascom & VB6
»Analog clock on SSD1289 3.2" 240x320 lcdAnalog clock on SSD1289 3.2" 240x320 lcd
»Nextion HMI lcd with KaraDio the best webradio esp8266Nextion HMI lcd with KaraDio the best webradio esp8266
»Adding 240x320 lcd to the WifiWebRadioAdding 240x320 lcd to the WifiWebRadio


Date published: not known
Details

»Bascom Can Bus Sniffer
»R.I.P Ben Zijlstra
Remembering Ben Zijlstra We hope that people who love Ben will remember and celebrate his life. more info at MCS www.mcselec.com/index2.ph...
»KaRadio webradio ESP8266
The Dimitris board is available at https://github.com/dsaltas/WiFi-WebRadio  This is a hardware project for Ka-Radio
»93C46
small tool to edit 93C46 eeprom written in BascomAVR & VB  Bascom control the 93C46 so we sent data via comport from VB code will be added later ...
»nRF24L01+ RC Controller
This is a RC controller TX & RX unit with nRF24L01+ nRF24L01+ / with PA and LNA for longer range facts: TX 1 x potmeter for servo ...
»RAW lcd
Connecting RAW lcd to atmega8 the lcd is 6 digit + time glass LCD Hour Meter for  tractor ,air compressor, ect the lcd have 4 com pins  & 14...


Date published: not known
Details


Proudly powered by e107 Bootstrap CMS which is released under the terms of the GNU GPL License.