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

This page ever ...
total: 199
unique: 130

Site ...
total: 2979
unique: 1445
Online
  • Guests: 2
  • Members: 0
  • Newest Member: ole
  • Most ever online: 47
    Guests: 47, Members: 0 on Wednesday 21 February 2018 - 23:52:15
Chatbox
You must be logged in to post comments on this site - please either log in from the Login box or from here.If you are not registered click here to signup.


bullet Kim
1 year ago
test
Royalsystems blog

MCS Electronics Forum

  • BASCOM-AVR : Odd behavior with select-case : REPLY



    I have always done my select/case like this so never had that problem
    I find it easier to read
    Regards Paul



    [code:1:49293badd5]
    Select Case P
    Case 1
    Print "All is ok"
    Case 2
    Print "Some error occurred"
    Goto Brake_here
    Case Else
    Print "Unknown error"
    Goto Brake_here
    End Select

    [/code:1:49293badd5]

  • Share your working BASCOM-AVR code here : Function added to OLED library 'glcdSSD1306-I2C.lib' : REPLY



    Hallo, Its Work, Thank you well, Is a new time for me to Prog with LCD´s, so i have a Problem with the fonts. I use a LCD Display with 0,92" and a resulution of 128x32 (other infos from web says 128x64.
    After Prog a Programm with

    Lcdat 2,10, "1995-2015"
    Lcdat 3,5, "MSC Electronic" ,1

    the fonts not readebel
    see the Pictures...
    can you help by the next Steps??
    Thanks a lot BoA

  • BASCOM-AVR : Odd behavior with select-case : NEWTOPIC



    Hi,
    I came accros this odd behavior with select-case statement used together with Goto.
    Two statements separated by a ":" on the Case Else line will throw an error if last statement is a Goto.
    If the second statement are moved one line down, the code will compile and work as expected.
    Its no big deal doing this as an workaround, but I'm curious why.

    Compiler version :2.0.8.1
    Compiler build :2.0.8.1.000
    IDE version :2.0.8.1.001
    Windows OS :Windows 10 Pro

    [code:1:e2d55d65d6]$regfile = "m328pdef.dat"
    $crystal = 16000000
    $hwstack = 100
    $swstack = 100
    $framesize = 100
    $baud = 38400

    $sim



    Dim P As Byte

    ' THIS GIVES > Error : 323 Line : 19 Label Too Long [ "UNKNOWN ERROR" : Goto Brake_here]
    P = 1
    Select Case P
    Case 1 : Print "All is ok"
    Case 2 : Print "Some error occurred" : Goto Brake_here
    Case Else : Print "Unknown error" : Goto Brake_here
    End Select



    ' THIS WILL COMPILE AND WORK AS EXPECTED
    P = 2
    Select Case P
    Case 1 : Print "All is ok"
    Case 2 : Print "Some error occurred" : Goto Brake_here
    Case Else : Print "Unknown error"
    Goto Brake_here ' THE GOTO FOR CASE ELSE MOVED TO NEXT LINE
    End Select

    Brake_here:
    Print "P= " ; P
    End[/code:1:e2d55d65d6]

    [b:e2d55d65d6][color=red:e2d55d65d6](BASCOM-AVR version : 2.0.8.1 )[/b:e2d55d65d6][/color:e2d55d65d6]

  • BASCOM-AVR : Receiving zero(0) bytes : REPLY



    Above is whole code which works well (tested) with all charcters (0 or not) which have carriage return/linefeed, or with received bytes (not chr) with (at least of one) value >0. But when UART received only 0 bytes, not characters, then Ischarwaiting() don't return 1, it don't see 0 like received byte.

  • BASCOM-AVR : Receiving zero(0) bytes : REPLY



    [quote:5aae93e45e="Flash"]This is not a code,[/quote:5aae93e45e]
    Yes, you're right, these are only unrelated lines, but no code which would allow o tackle the issue.
    [quote:5aae93e45e]I don't need to use inkey, waitkey, inputbin etc. only confirmation of receipt.[/quote:5aae93e45e]
    Without use of any of these, or similar commands the input buffer won't be emptied.
    Makes no sense.
    If you expect help, post a compilable example which shows the problem.

  • BASCOM-AVR : Receiving zero(0) bytes : REPLY



    [quote:93e6a2625b="MWS"][quote:93e6a2625b="Flash"]because Ischarwaiting=0 if all bytes are zero(0)[/quote:93e6a2625b]
    Your statement is wrong.

    Ischarwaiting() returns an 1 for a byte received, doesn't matter of the byte's value.
    Your code - which you do not show - is flawed.[/quote:93e6a2625b]

    This is not a code, I know that Ischarwaiting() returns an 1, here is question why it don't return 1 when I received e.g. three bytes in a row and all of this three have value 0x00, shouldn't Ischarwaiting() recognize this bytes with value=0?
    This is the simple code (AT90CAN):
    [code:1:93e6a2625b]
    Config Com2 = Dummy , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0
    Open "COM2:" For Binary As #2
    Config Serialin1 = Buffered , Size = 100

    'Slave send some bytes (3 or more) with 0x00 values (I can see them on logic analyzer) on COM2 UART - Ischarwaiting(#2) = 0

    If Ischarwaiting(#2) = 1 Then 'loop through data
    'do something
    Else
    'do something
    End if
    [/code:1:93e6a2625b]
    When is one of the received byte with value >0 (e.g. 0x01) then is all ok -Ischarwaiting(#2) = 1. I dont need to use inkey, waitkey, inputbin etc. only confirmation of receipt.

  • BASCOM-AVR : Receiving zero(0) bytes : REPLY



    see the help about null character
    I suppose you know but ...
    null ascii 0 is different of "0" chr ( 48 )

    Help said
    "you can send and receive both with While the Inkey() will get the character from the HW UART when there is a character in the buffer, it will return a zero when the character is zero. This makes it unusable to work with binary data that might contain the value 0."

    Ischarwaiting()

    "While the Inkey() will get the character from the HW UART when there is a character in the buffer, it will return a zero when the character is zero. This makes it unusable to work with binary data that might contain the value 0.
    With IsCharWaiting() you can first check for the presence of a character and when the function returns 1, you can retrieve the character with Inkey or Waitkey."

    so ischarwaiting return 1 when you send it a null but inkey see nothing.

    so please send us a your code
    JP
    :wink:

  • BASCOM-AVR : Receiving zero(0) bytes : REPLY



    [quote:241d6cbbf2="Flash"]because Ischarwaiting=0 if all bytes are zero(0)[/quote:241d6cbbf2]
    Your statement is wrong.

    Ischarwaiting() returns an 1, doesn't matter of the received value.
    Your code - which you do not show - is flawed.

  • BASCOM-AVR : Receiving zero(0) bytes : REPLY



    Hi,

    Maybe a Do Loop while ISCHARWAITING. Something like:-

    [code:1:cfbcb9bfc4]
    While Ischarwaiting(#2) = 1 'loop through data
    Rfid_char = Inkey(#2) 'Get 1 byte
    If Rfid_char = 2 Then 'Chr 2 - Start of MSG
    Rfid_ptr = 0 'Reset pointer
    Else
    Incr Rfid_ptr 'Move to next byte
    Rfid_array_local(rfid_ptr) = Rfid_char 'Save char to array
    End If
    If Rfid_ptr >= 12 Then ' correct length
    Rfid_have_buffer = 1 'tell user space
    Rfid_ptr = 0 'Reset buffer pointer
    Exit While 'Move on
    End If
    Wend
    [/code:1:cfbcb9bfc4]

    In this example CHR(2) is the start of a message the message is always 12 bytes long and the data lands in a Byte array (Rfid_array_local). Note I'm using buffered serial i/o so this routine doesn't need to be called that often.


    Regards
    Ian Dobson

  • BASCOM-AVR : Receiving zero(0) bytes : NEWTOPIC



    Is there some way for UART receiving zero bytes (e.g. 0,0,0,0), because Ischarwaiting=0 if all bytes are zero(0), only if one is >0 (0,0,0,1) then it worrks fine. Problem is because slave send some empty bytes data which can't be changed.
    Thanks

    [b:8b8d1f822d][color=red:8b8d1f822d](BASCOM-AVR version : 2.0.8.1 )[/b:8b8d1f822d][/color:8b8d1f822d]

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

Password:




[ ]
[ ]
Headlines

»BASCOM-AVR : Odd behavior with select-case : REPLY
I have always done my select/case like this so never had that problem I find it easier to read Regards Paul [code:1:49293...
»Share your working BASCOM-AVR code here : Function added to OLED library 'glcdSSD1306-I2C.lib' : REPLY
Hallo, Its Work, Thank you well, Is a new time for me to Prog with LCD´s, so i have a Problem with the fonts. I use a LCD Display ...
»BASCOM-AVR : Odd behavior with select-case : NEWTOPIC
Hi, I came accros this odd behavior with select-case statement used together with Goto. Two statements separated by a ":" on the...
»BASCOM-AVR : Receiving zero(0) bytes : REPLY
Above is whole code which works well (tested) with all charcters (0 or not) which have carriage return/linefeed, or with received ...
»BASCOM-AVR : Receiving zero(0) bytes : REPLY
[quote:5aae93e45e="Flash"]This is not a code,[/quote:5aae93e45e] Yes, you're right, these are only unrelated lines, but no code w...
»BASCOM-AVR : Receiving zero(0) bytes : REPLY
[quote:93e6a2625b="MWS"][quote:93e6a2625b="Flash"]because Ischarwaiting=0 if all bytes are zero(0)[/quote:93e6a2625b] Your statem...
»BASCOM-AVR : Receiving zero(0) bytes : REPLY
see the help about null character I suppose you know but ... null ascii 0 is different of "0" chr ( 48 ) Help said "you can ...
»BASCOM-AVR : Receiving zero(0) bytes : REPLY
[quote:241d6cbbf2="Flash"]because Ischarwaiting=0 if all bytes are zero(0)[/quote:241d6cbbf2] Your statement is wrong. Ischarw...
»BASCOM-AVR : Receiving zero(0) bytes : REPLY
Hi, Maybe a Do Loop while ISCHARWAITING. Something like:- [code:1:cfbcb9bfc4] While Ischarwaiting(#2) = 1 ...
»BASCOM-AVR : Receiving zero(0) bytes : NEWTOPIC
Is there some way for UART receiving zero bytes (e.g. 0,0,0,0), because Ischarwaiting=0 if all bytes are zero(0), only if one is >...


Date published: not known
Details

»Verschiedene Tools für die Entwicklung rund um Mikrokontroller
Ich stelle hier verschiedene überarbeitete oder neue Tools vor, die bei der Entwicklung rund um Mikrokontroller hilfreich sein können. Einige Tools...
»Fusebits-Entschlüsselung
Guten Morgen Wie man die Fusebits Einstellt weiß ich, wie entschlüsselt man die? Wenn ich einen Externen Quarz mit 4 Mhz. an klemme wie sieht das...
»ATMega328 Funktioniert nicht mit Wait?
Hallo, ich stehe mal gerade bissel auf dem Schlauch. Da ich die kleinen ATMega328 Pro Mini Module, welche es für paar Cent bei Ebay gibt, für einf...
»SSD1306 OLED Display
Hallo, OLED Display SSD1306 in der Größe 0.96 Zoll oder 1.3 Zoll mit der Auflösung 128x64 oder 128x32 Pixel. Das Display wird in der Regel mit I2...
»maximale Länge des I2C Kabels an einem Sensor....
Guten Morgen, Eine Frage zu der Maximalen länge eines Anschluss Kabels an einen Messensor. In meinem Fall der HP03S ein Kombi Sensor für Temeratu...
»Geregelter Aufwärtswandler 12V/24V
Hallo, ich bräuchte etwas HIlfe um diese Arbeit umzusetzen. Platine ist schon fertig, das Problem liegt nur noch im Programm schreiben, könnte mir ...


Date published: Wed, 16 Jan 2019 16:23:32 +0000
Details

»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
»IV-17 Nixie clock GPS set time & date at power onIV-17 Nixie clock GPS set time & date at power on


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 which is released under the terms of the GNU GPL License.