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

This page ever ...
total: 114
unique: 93

Site ...
total: 5143
unique: 3193
Online
  • Guests: 4
  • 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 : Simulation of an interrupt on the ATMega328PB in the interna : NEWTOPIC



    Hi,
    When I try to simulate the attached code in the BASCOM built-in simulator, two interrupt buttons appear correctly on the interrupt tab: OC2A and OC3A. After starting the simulation and clicking on OC2A, the variable v2 increments, but nothing happens when I click on OC3A. It works correctly with the ATmega1284p processor. Am I doing something wrong?

    (Compiler build 2.0.8.7.003)
    Thanks, Mirek

    [code:1:7a485b8199]$sim

    $version 1 , 0 , 54
    $regfile = "m328pbdef.dat"
    '$regfile = "m1284def.dat"


    $crystal = 20000000

    $hwstack = 72
    $swstack = 72
    $framesize = 40


    Config Timer2 = Timer , Compare A = Disconnect , Compare B = Disconnect , Prescale = 1 , Clear Timer = 1
    Compare2a = 10


    Config Timer3 = Timer , Compare A = Disconnect , Compare B = Disconnect , Prescale = 1 , Clear Timer = 1
    Compare3a = 10

    Dim V2 As Byte
    Dim V3 As Byte


    On Compare2a Tmr2
    Enable Compare2a


    On Compare3a Tmr3
    Enable Compare3a


    Enable Interrupts

    Do

    Loop

    Tmr2:
    Incr V2
    Return


    Tmr3:
    Incr V3
    Return


    [/code:1:7a485b8199]

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

  • BASCOM-AVR XTINY/MEGAX/AVRX : UART connection to the VB10A sensor : REPLY



    your mistake is that you use COM1 but PC0 and PC1 are for the second USART1. Thus use config COM2 instead.
    Always check the I/O multiplexing chapter 3 in the datasheet. Then check the column of the package which is the most left column Then look up the hardware resource like USARTn and 0,TXD means TX pin for the fist UART which is COM1 in BASCOM. Then also check the PIN column which is PA0 and PA1.

  • BASCOM-AVR XTINY/MEGAX/AVRX : UART connection to the VB10A sensor : REPLY



    Here is the documentation for the VB10A sensor: https://en.surertech.cn/viewfilebizce/1982625602085134336/surertech%20Specification-VB10A-V3.0.pdf

    I have my simple test board. The sensor's TxD is directly connected to PC1, and the sensor's RxD is connected to PC0.
    When I connected the sensor to the PC via the UART-USB adapter, I got the data as in the screenshot.
    The LCD display itself works very well. The libraries and description on this page are great: https://www.ne.jp/asahi/shared/o-family/ElecRoom/AVRMCOM/ColorLCD/AVRColorLCD.html

    It seems that there is something wrong with my UART configuration, because even a simple print does not send data to the PC.

    [code:1:720ccff545]Config PORTC.0 = Output
    Config PORTC.1 = input
    'configure the USART
    Config Com1 = 460800 , Mode = Asynchroneous , Parity = None , Databits = 8 , Stopbits = 1
    Config Serialin1 = Buffered , Size = 10
    Config Serialout1 = Buffered , Size = 10

    dim a as byte

    $lib "glcd-ST7735S_1R8_128x160.lib"
    Config Graphlcd = Color , Cs1 = Porte.5 , Rst = Porte.6 , A0 = Porte.7 , Si = Portf.0 , Sclk = Portf.1
    Initlcd
    Cls
    Setfont Color8x8
    Const Yellow = &B1111_1100
    Const Green = &B0001_1100
    Const Black = &B0000_0000
    waitms 10

    lcdat 1,1, " TEST VB10A ", Yellow , Black
    lcdat 12,1, " UART ", green , Black
    ENABLE INTERRUPTS
    A = 1
    do
    lcdat 32,12, a, green , Black
    Print "znak :" ; A
    incr a
    waitms 500
    loop
    $include "color8x8.font"[/code:1:720ccff545]

  • BASCOM-AVR XTINY/MEGAX/AVRX : UART connection to the VB10A sensor : REPLY



    You upgraded from AVR64da64.
    - from what
    - did you had working code before
    - did you test the UART using the terminal emulator? do you get data?
    - is it your own hardware or did you use some ready board? is there a circuit
    - please make samples simple as possible and leave out as much hardware as possible especial LCD displays that not everybody has
    - ideal is to use a second UART that debugs information. with the cheap USB-COM devices it is simple to add an additional COM port.

  • BASCOM-AVR XTINY/MEGAX/AVRX : UART connection to the VB10A sensor : REPLY



    Please post a link to the sensor's data sheet.

    JC

  • BASCOM-AVR XTINY/MEGAX/AVRX : UART connection to the VB10A sensor : NEWTOPIC



    Hi,
    I recently upgraded to an AVR64da64 and am trying to read data from a VB10A sensor. Unfortunately, my test program isn't reading any information. Could someone explain what I'm doing wrong?

    [code:1:e41f5594b7]$regfile = "AVRX64da64.dat"
    $crystal = 24000000
    $hwstack = 256
    $swstack = 256
    $framesize = 64
    $baud1 = 460800

    Config Porta = &B1111_0011
    Porta = &B0000_1100

    Config Portb = &B0111_1111
    Portb = &B1000_0000

    Config Portc = &B1111_1000
    Portc = &B0000_0100

    Config Portd = &B0000_0000
    Portd = &B0000_0000

    Config PortE = &B1110_0011
    PortE = &B0000_0110

    Config PortF = &B010_0011
    PortF = &B110_0000

    Config PortG = &B1111_1110
    PortG = &B0000_0001

    'The AVRX series have more oscillator options
    Config Osc = Enabled , Frequency = 24mhz

    'set the system clock and prescaler
    Config Sysclock = Int_osc , Prescale = 1

    config portc.2 = input
    Config Xpin = portc.2, Pullup = Pullup
    config portb.7 = input
    Config Xpin = portb.7, Pullup = Pullup

    Config PORTC.1 = Output
    Config PORTC.0 = input

    sw_4 alias pinc.2
    sw_2 alias pinb.7


    '------------------- TFT ---------------------------
    Const Portrait = 0
    Const Rotate_180 = 1

    'configure the USART
    Config Com1 = 460800 , Mode = Asynchroneous , Parity = None , Databits = 8 , Stopbits = 1
    Open "COM1:" For Binary As #1
    Config Serialin1 = Buffered , Size = 10

    'dimension a variable
    Dim znak As Byte
    Dim ramka(4) As Byte
    Dim Idx As Byte
    Dim Dystans As Word
    Dim kontrol As Byte
    Dim suma_kontrol As word


    $lib "glcd-ST7735S_1R8_128x160.lib"
    Config Graphlcd = Color , Cs1 = Porte.5 , Rst = Porte.6 , A0 = Porte.7 , Si = Portf.0 , Sclk = Portf.1
    Initlcd
    Cls
    Setfont Color8x8
    Const Red = &B1110_0000
    Const Yellow = &B1111_1100
    Const Orange = &B1110_1100
    Const Green = &B0001_1100
    Const White = &B1111_1111
    Const Black = &B0000_0000
    Const Blue = &B0000_0011
    Const Magenta = &B1110_0011
    waitms 10

    led_lcd alias portf.5
    led_lcd=0

    waitms 50

    lcdat 1,1, " TEST VB10A ", Yellow , Black
    lcdat 12,1, " UART ", green , Black
    idx=0
    ENABLE INTERRUPTS

    do
    If Ischarwaiting(#1) > 0 Then
    znak = Inkey(#1)
    If Idx = 0 Then
    If znak = &H5C Then
    Idx = 1
    ramka(1) = znak
    End If
    Else
    Incr Idx
    ramka(idx) = znak
    End If

    If Idx = 4 Then
    suma_kontrol = ramka(2) + ramka(3)
    kontrol = Low(suma_kontrol)
    kontrol = Not kontrol
    If kontrol = ramka(4) Then
    Dystans = ramka(3)
    Shift Dystans , Left , 8
    Dystans = Dystans + Ramka(2)
    lcdat 32,1, hex(ramka(1)); " "; hex(ramka(2)); " ";hex(ramka(3)); " ";hex(ramka(4)); " " , orange , Black
    lcdat 42,1, "D= "; dystans; " mm ", red, black
    end if
    Idx = 0
    end if
    end if
    waitms 5
    loop
    $include "color8x8.font"[/code:1:e41f5594b7]

  • BASCOM Project Blog : Audio spectrum analyzer. : REPLY



    Hello!

    Finally I had an ocassion to test it :lol:

    In the lib there is one error:

    [code:1:9fba150818]
    ;This routine is called when the LCD must be initialized
    [_Init_LCD]
    .EQU cu_rs = 3 ; PD.3 = cu register select line
    .EQU cu_en = 4 ; PD.4 = cu enable line
    .EQU cu_en2= 2 ; PD.5 = cu enable line 2
    .EQU cu_wr = 6 ; PD.6 = cu write
    [/code:1:9fba150818]

    [b:9fba150818].EQU cu_en2= 2 must be .EQU cu_en2= 5[/b:9fba150818]

    2x LCDs are working fine.

    To be continued :lol:

    Regards,
    Przemek

  • New WebSite : test : REPLY



    Yes that is a relief. As you might have understood i migrated the server. It was a lot of work and all was tested using a different domain name. but after migration still some things were broken.
    That is because i tried to update all software. For this forum and some other components that was not possible. At least not yet.
    Now i need to recover. cheesey

  • New WebSite : test : REPLY



    working cheesey

  • New WebSite : test : NEWTOPIC



    test

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

Password:




[ ]
[ ]
Headlines

»BASCOM-AVR : Simulation of an interrupt on the ATMega328PB in the interna : NEWTOPIC
Hi, When I try to simulate the attached code in the BASCOM built-in simulator, two interrupt buttons appear correctly on the inte...
»BASCOM-AVR XTINY/MEGAX/AVRX : UART connection to the VB10A sensor : REPLY
your mistake is that you use COM1 but PC0 and PC1 are for the second USART1. Thus use config COM2 instead. Always check the I/O m...
»BASCOM-AVR XTINY/MEGAX/AVRX : UART connection to the VB10A sensor : REPLY
Here is the documentation for the VB10A sensor: https://en.surertech.cn/viewfilebizce/1982625602085134336/surertech%20Specificatio...
»BASCOM-AVR XTINY/MEGAX/AVRX : UART connection to the VB10A sensor : REPLY
You upgraded from AVR64da64. - from what - did you had working code before - did you test the UART using the terminal emulator?...
»BASCOM-AVR XTINY/MEGAX/AVRX : UART connection to the VB10A sensor : REPLY
Please post a link to the sensor's data sheet. JC
»BASCOM-AVR XTINY/MEGAX/AVRX : UART connection to the VB10A sensor : NEWTOPIC
Hi, I recently upgraded to an AVR64da64 and am trying to read data from a VB10A sensor. Unfortunately, my test program isn't read...
»BASCOM Project Blog : Audio spectrum analyzer. : REPLY
Hello! Finally I had an ocassion to test it :lol: In the lib there is one error: [code:1:9fba150818] ;This routine is ...
»New WebSite : test : REPLY
Yes that is a relief. As you might have understood i migrated the server. It was a lot of work and all was tested using a differen...
»New WebSite : test : REPLY
working :D
»New WebSite : test : NEWTOPIC
test


Date published: not known
Details

»Taster mit transparenten Kappen zum Beschriften
Lange gesucht und jetzt endlich gefunden. Für Selbstbauprojekte die auch "nach etwas aussehen sollen", ist es schön, wenn man Bedienelemente hat, w...
»Int1 Durchgriffsrecht, Hierarchieproblem.
Grüß Euch Eine kurze beschreibung des Programmablauf. Es werden 10 Phasen durchlaufen, ab Phase 5 nur mehr Zeitgesteuert. Ich habe jetzt eine Brem...
»DA-Wandler MCP4725
Hallo, Den A/D-Wandler auf Platinchen hätte ich gerne verwendet. MCP4725 Gibt es hier Unterlagen/Anleitungen/Code um ihn mit einem AVR "m2560de...
»Farb-Gradient Lookup Tabelle erstellen (z.B. für WS2812b)
Bei der Verwendung von WS2812B-LEDs (oder ähnlichen) werden die benötigten Farbwerte manchmal in Lookup Tabellen vorgehalten. Tschoeatsch's Laterne...
»Frohe Ostern
Euch allen ein frohes Osterfest Wünsche euch weiterhin interessante Projekte mit unserem wunderbarem Hobby. Jetzt noch eine Bitte in eigener Sache...
»Clock with alarm
A working version of the Alarm Clock program. I want to improve the program so that it can record sound to a flash drive via ADC (but I don’t know ...


Date published: Mon, 13 Apr 2026 12:22:31 +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.