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

This page ever ...
total: 217
unique: 148

Site ...
total: 3985
unique: 2201
Online
  • Guests: 5
  • 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

  • Various : GUI-O Live Designer : REPLY



    thank you very much for this info. old phones get a new purpose cheesey

  • BASCOM-AVR : UPDI : REPLY



    another update for the updi programmer. get it from the SLA area. it fix a problem where the updi interface was not properly reset.
    this update performs very good at 1600000 baud.

    there was no feedback about the 12 v pulse.
    but the mliab-snap will be supported in either 2086 or 2087.
    came a long way with this.
    notice that this snap programmer is great but requires r28 to be removed and it need a firmware update.

  • BASCOM-AVR : ERROR on ERAM Write : REPLY



    you can write to support. one user contacted me but the mail bounced.
    i prefer to keep compiler/add on updates in sync. otherwise i would publish this change.

  • BASCOM-AVR : Software UART and WAITKEY - Exit if no incoming data : REPLY



    From the Help: "$Timeout - Enable timeout on the hardware UART [b:c45d547c6d]and software UART[/b:c45d547c6d]."

    [img:c45d547c6d]https://www.mcselec.com/userpix/22760_sim_3.jpg[/img:c45d547c6d]

    Works like a charm.

    BTW. All four USARTS from Mega2560 you chave used already or this is unefficient design?

  • BASCOM-AVR : Software UART and WAITKEY - Exit if no incoming data : NEWTOPIC



    This may have been answered before, but I couldn't' find it in a search.

    I guess I am looking for the best way to send and receive binary data over a software serial port.

    I added a software UART to an ATMEGA2560 circuit on some unused pins using the OPEN COM...(#4) command. It works fine, and I can get my serial data in and out. However, the only BASCOM command to receive the input data from a software defined UART appears to be the WAITKEY command, and this will wait forever if there is no incoming serial data. I need to be able to exit the WAITKEY command if no data is received after I request it, after some timeout. Do any of the other serial commands like ISCHARWAITING work with the software UART?

    I have done some testing, and it appears that if the software UART input is LOW, the WAITKEY will proceed, and return a value of $00, with or without the $TIMEOUT command. However, if the software UART input is HIGH, then the WAITKEY will hang forever. I have tried adding the $TIMEOUT = 1000000 command, but it does not seem to prevent this issue. Perhaps this is because of the Port Number I opened?

    Using INKEY or GET instead of WAITKEY seems to give the same results. I cannot use INPUT, because the input is binary data, without CR or LF.

    I looked at the newer SERIN and SEROUT commands, but they are only for Strings as well, and I'm not sure if they provide a timeout feature either. Also, the Baud rate calculation seems to be pretty far off, at least in version 2.0.8.2. Perhaps there is a way to use strings with binary data, but since $00 is in the data, I think that would terminate the string.

    Any other ideas on how to accomplish this would be appreciated.

    Thanks,
    Dave

    [b:94a00b176c][color=red:94a00b176c](BASCOM-AVR version : 2.0.8.2 , Latest : 2.0.8.5 )[/b:94a00b176c][/color:94a00b176c]

  • BASCOM-AVR : Constants and #if : REPLY



    [quote:ecd6493445="njepsen"]but wrapped in an abrasive wrapper.[/quote:ecd6493445]
    As usual. Either stand it or ignore my message.
    [quote:ecd6493445]I DO understand how conditional compilation works, but had missed the point that[/quote:ecd6493445]
    I was rather stunned that you did not recognize the logical quandary that the compiler needs information at compile-time, which he only can get later at run-time.

    [quote:ecd6493445]Why do i use constants and conditional compilation you ask?[/quote:ecd6493445]
    JP asked that and added the 'beginner' wink

    Of course I asked myself too, but rather why your post did not first explain the exact purpose, instead of presenting an unusable solution.
    [quote:ecd6493445][code:1:ecd6493445]const has_pi = 1
    const has_camera = 1
    const has weather=0
    const site_phone = "+64 1234567"[/code:1:ecd6493445][/quote:ecd6493445]This is well understood, but still does not explain your initial question, which was something about working with strings.

    I will give some random hints:
    As
    [code:1:ecd6493445]const fred = "fre" + myvariable[/code:1:ecd6493445]does not work, it may be sufficient to put the variable's initialization into a constant first and then assign further.
    [code:1:ecd6493445]dim fStr As String * 30
    const site_phone_cc = "+64"
    const site_phone_phn = "1234567"
    const site_phone = site_phone_cc + " " + site_phone_phn
    const fred = "fre" + site_phone_phn

    fStr = const site_phone

    #IF fred = "fre1234567"
    ' inlcude code
    #ENDIF[/code:1:ecd6493445]
    Also notice that the command VAREXIST() - despite its name - works also for constants, this allows for checking if a constant or variable was declared at all.
    [quote:ecd6493445]MWS you need to be careful that members are afraid to ask a question that you might consider a "beginners question" and get harpooned by your caustic response.[/quote:ecd6493445]I grew too old to care if my answer is seen as caustic or not.

    Also I tend to serve as it comes in, means adapt my response on how good the question is done.
    For your case: you're in the forum since 15 years, not only you did ask a beginner's question, but you have asked beginner-like.
    Beginners often describe not what they exactly want, instead present an unsuitable solution, while the reader's first riddle to solve is: what does the TO want at all?
    Had you described in your top post exactly what you want, we'd be already further.

    Also it seems you took offense from the description 'beginner', which - as well you acted alike - you are not. Your self esteem should be raised enough and you should be mentally sufficiently hardened to simply ignore that.

    In contrary, what about if I would tell a beginner he asks beginner questions?
    Well, as this would be only obvious, would I do that? Likely no, as his level would show.

    [quote:ecd6493445]and am not afraid to do so. [/quote:ecd6493445]Good, that's the proper attitude to withstand my answers cheesey
    [quote:ecd6493445]I do value your expertise.[/quote:ecd6493445]Thanks.

  • BASCOM-AVR : Constants and #if : REPLY



    Hello MWS and thank you for your reply. As usual, your reply is very helpful and on the money, but wrapped in an abrasive wrapper.
    I DO understand how conditional compilation works, but had missed the point that [quote:1b0f969940]
    To resolve a constant, anything included into an equation needs to be a constant itself.[/quote:1b0f969940]
    and had overlooked the fact that a var in the equation is of course not evaluated until run time, not compile time.

    Why do i use constants and conditional compilation you ask? I have 100 or so units in the field all of which use IDENTICAL code, but some do slightly different things and some for example have an on board raspberry Pi and others don't. Some units have cameras, some have different instrumentation so CC allows them to function as required, all with the same main code body, and a different setups in a list of const in the code header.

    [code:1:1b0f969940]
    code
    const has_pi = 1
    const has_camera = 1
    const has weather=0
    const site_phone = "+64 1234567"
    'etc

    'main body
    #if has_pi = 1
    ' do lots of things
    ' not compiling this code save me about 20% of code space, and makes a BIG difference to compile time
    #endif
    [/code:1:1b0f969940]

    MWS you need to be careful that members are afraid to ask a question that you might consider a "beginners question" and get harpooned by your caustic response. I am not a beginner, but I am allowed to ask a beginners question from time to time, and am not afraid to do so.
    As a parting shot - I do value your expertise.

  • BASCOM-AVR : Constants and #if : REPLY



    [quote:db3c8b0d25="Duval JP"]Njepsen is not a beginner,[/quote:db3c8b0d25]It is a beginner-like question.
    [quote:db3c8b0d25]if he pauses [i:db3c8b0d25](poses)[/i:db3c8b0d25] the question it is because he needs this feature.[/quote:db3c8b0d25]If he understands how conditional compilation works, then he can't want this feature, as it's an impossible one.
    [quote:db3c8b0d25]I assume because my variable can be changed after compilation[/quote:db3c8b0d25]He assumes right.
    It's an hen/egg problem.
    How would the compiler know whether to include code at compile-time, if the conditions for the inclusion are only set in later in run-time.
    Njepsen would do better to describe the problem, instead of an impossible solution.

  • BASCOM-AVR : Constants and #if : REPLY



    Hi MWS

    Njepsen is not a beginner, if he pauses the question it is because he needs this feature.
    Indeed I asked myself the question : Why this step?

    So Niepsen would you explain the needed ?
    JP

    :wink:

  • BASCOM-AVR : Constants and #if : REPLY



    [quote:0ad92032e1="njepsen"]
    [code:1:0ad92032e1]
    #if echo_site = tempstr
    'do stuff
    #endif
    [/code:1:0ad92032e1][/quote:0ad92032e1]
    Maybe you ask yourself about the sense of conditional compilation and why you would use it in a place, where regular use of an IF/THEN command is due.

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

Password:




[ ]
[ ]
Headlines

»Various : GUI-O Live Designer : REPLY
thank you very much for this info. old phones get a new purpose :D
»BASCOM-AVR : UPDI : REPLY
another update for the updi programmer. get it from the SLA area. it fix a problem where the updi interface was not properly reset...
»BASCOM-AVR : ERROR on ERAM Write : REPLY
you can write to support. one user contacted me but the mail bounced. i prefer to keep compiler/add on updates in sync. otherwis...
»BASCOM-AVR : Software UART and WAITKEY - Exit if no incoming data : REPLY
From the Help: "$Timeout - Enable timeout on the hardware UART [b:c45d547c6d]and software UART[/b:c45d547c6d]." [img:c45d547c6d...
»BASCOM-AVR : Software UART and WAITKEY - Exit if no incoming data : NEWTOPIC
This may have been answered before, but I couldn't' find it in a search. I guess I am looking for the best way to send and rece...
»BASCOM-AVR : Constants and #if : REPLY
[quote:ecd6493445="njepsen"]but wrapped in an abrasive wrapper.[/quote:ecd6493445] As usual. Either stand it or ignore my message...
»BASCOM-AVR : Constants and #if : REPLY
Hello MWS and thank you for your reply. As usual, your reply is very helpful and on the money, but wrapped in an abrasive wrapper....
»BASCOM-AVR : Constants and #if : REPLY
[quote:db3c8b0d25="Duval JP"]Njepsen is not a beginner,[/quote:db3c8b0d25]It is a beginner-like question. [quote:db3c8b0d25]if he...
»BASCOM-AVR : Constants and #if : REPLY
Hi MWS Njepsen is not a beginner, if he pauses the question it is because he needs this feature. Indeed I asked myself the que...
»BASCOM-AVR : Constants and #if : REPLY
[quote:0ad92032e1="njepsen"] [code:1:0ad92032e1] #if echo_site = tempstr 'do stuff #endif [/code:1:0ad92032e1][/quote:0ad...


Date published: not known
Details

»TWI Master mehrere Slave
Hallo User, ich beschäftige mich seit Tagen mit TWI und komme nicht weiter Ich baue gerade eine Clock24 , dazu wollte ich 12 Atmega 328 als Slave u...
»Bootloader stoppt Mikrocontroller
Hallo alle zusammen, Ich hab mal wieder ein Problem, dem ich alleine nicht herr werde. Dieses mal ist es etwas seltsam, denn wenn ich den Bootload...
»Led Display UC1609 19264-05 V3.2
Gute Nacht. Ich bin auf ein solches Display auf dem UC1609 192x64 gestoßen, ich habe Bibliotheken für Baskom auf UC1601 und UC1608 (8-Bit-Parallel...
»Flip-Flop mit zwei Eingängen
Hi Forum, wir haben hier gerade die kleine Schwester einer großen Maschine gebaut, mit der ich in meinem Büro an der Software weiterarbeiten kann,...
»Maschinensteuerung
Guten Abend alle zusammen. Die Jungs wollen eine Schreibmaschine auf dem Bedienfeld machen, zuerst habe ich die Module LC12S für die Kommunikation...
»Attiny24 Soft-Uart
Guten Morgen allerseits, ich habe eine kleine Schaltung mit einen Attiny24 aufgebaut, mit der ich über einen seriellen Befehl 3 Ausgänge schalten ...


Date published: Sat, 21 May 2022 12:20:27 +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.