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

This page ever ...
total: 213
unique: 144

Site ...
total: 3469
unique: 1846
Online
  • Guests: 4
  • 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 : dim Jbit as bit : REPLY



    hi Laborate, Spiczu, Dave
    sometimes it's good to revise the fundamentals

    and appreciate your help, the Bascom community is very alive !

    I did program from years I never use bit or only in boolean false/true
    but indeed the use of [list:42666ea1fb]Code:
    dim A as Bit
    dim B as Bit
    dim C as Bit
    dim D as Bit

    ' and optional for Testing:
    dim BitContainer as byte at A overlay


    is equivalent to

    Code:
    dim BitContainer as byte

    A alias BitContainer.7
    B alias BitContainer.6
    C alias BitContainer.5
    D alias BitContainer.4[/list:u:42666ea1fb]

    is very simple
    As you said Laborate' in other words' many thanks to Marks to do all this possibilities

    [b:42666ea1fb]bits[/b:42666ea1fb] and [b:42666ea1fb]Nbits[/b:42666ea1fb] will be very usefull too
    JP :wink:

  • BASCOM-AVR : HX711 : REPLY



    Yes, I think it takes some effort.

    The coefficient calculation of the program changes depending on the power supply voltage (AVDD) for the load cell of the HX711 and the characteristics (resistance value and output voltage) of the load cell.
    Also, for each of the four load cells, error adjustment and zero adjustment are required, so simply speaking, the program is quadrupled.
    It corresponds to the idea of measuring with four separate AVR circuits and summarizing the four results obtained.

    Simply asking only the subroutine part of a program can be difficult to solve if you don't know how the entire program works.
    It may take some time, but do your best!

  • BASCOM-AVR : HX711 : REPLY



    Thanks.
    I understand simple basic programming but this is too complicated for an old man like me and therefore I wants lots of help, help with the whole program is of course invaluable help and thanks.
    To learn this I think will be very time consuming for a hobby project.
    Thanks

  • BASCOM-AVR : HX711 : REPLY



    If the questioner has a high level of programming, we can also suggest simplifying the program.
    For example, the [PD_SCK] pin is shared by all four ports and connected to one port, and only the pin is received individually by the four ports.
    However, since many modifications of the provided test program are required, I proposed a method to make the four easiest subroutines by copying.

    Even so, the questioner often doesn't understand the BASIC language.
    You'll have to learn a little more and then ask questions or ask for all the programming.

  • BASCOM-AVR : HX711 : REPLY



    I use this code when I have only one HX711

    $regfile = "m8def.dat"

    $crystal = 3686400

    $baud = 9600

    $hwstack = 64
    $swstack = 10
    $framesize = 24

    Hx711_clk Alias Portb.0
    Hx711_dat Alias Pinb.1

    Dim Hx711ad As Long
    Dim Hx711avg As Long
    Dim Hx711count As Byte
    Dim Average(16) As Long
    Dim Avgpoi As Byte
    Dim Avgsum As Long
    Dim Zeroadj As Long
    Dim Stablecount As Byte
    Dim Lastvalue As Long
    Dim Sensorcal As Long
    '
    Dim Temp1 As Byte
    Dim Temp2 As Byte
    Dim Templ1 As Long
    Dim Tempstr As String * 40
    '
    Dim Dummy As Eram Long
    Dim Eepprgid As Eram Long
    Dim Eepsensorcal As Eram Long


    Config Hx711_clk = Output
    Reset Hx711_clk
    Config Hx711_dat = Input

    If Eepprgid <> &H31375848 Then
    Eepprgid = &H31375848
    Eepsensorcal = 30065
    End If
    Sensorcal = Eepsensorcal

    For Temp1 = 1 To 20
    Do

    Loop Until Hx711_dat = 0
    '
    Gosub Hx711get
    Gosub Hx711movavg
    Locate 2 , 1
    Print Hex(hx711avg)
    Next Temp1

    Zeroadj = 0 - Hx711avg
    Stablecount = 0
    Lastvalue = 0

    Temp2 = 0

    Main:
    If Hx711_dat = 0 Then
    Gosub Hx711get
    Gosub Hx711movavg
    Templ1 = Hx711avg + Zeroadj

    Templ1 = Templ1 * 100
    Templ1 = Templ1 / Sensorcal
    '
    Temp2 = Temp2 + 1
    If Temp2 > 10 Then
    Temp2 = 0
    End If


    waitms 100
    Tempstr = Str(templ1)
    If Templ1 < 0 Then
    print Format(tempstr , " 0")
    If Temp2 = 0 Then
    Print Format(tempstr , " 0")
    End If
    Else
    print Format(tempstr , " 0")
    If Temp2 = 0 Then
    Print Format(tempstr , " 0")
    End If
    End If

    If Templ1 = Lastvalue Then
    Stablecount = Stablecount + 1
    If Stablecount > 5 Then
    Stablecount = 5

    End If
    Else
    Lastvalue = Templ1
    Stablecount = 0

    End If
    End If
    Goto Main



    Hx711get:
    Hx711ad = 0
    For Hx711count = 23 To 0 Step -1
    Set Hx711_clk
    Waitus 1
    Hx711ad.hx711count = Hx711_dat
    Reset Hx711_clk
    Waitus 1
    Next Hx711count

    Set Hx711_clk
    Waitus 1
    Reset Hx711_clk
    Waitus 1
    '
    If Hx711ad.23 = 1 Then
    Hx711ad = Hx711ad Or &HFF000000
    End If
    Return


    Hx711movavg:
    Avgsum = Avgsum - Average(avgpoi)
    Average(avgpoi) = Hx711ad
    Avgsum = Avgsum + Hx711ad
    '
    Avgpoi = Avgpoi + 1
    If Avgpoi > 16 Then
    Avgpoi = 1
    End If
    '
    Hx711avg = Avgsum
    Shift Hx711avg , Right , 4 , Signed
    Return

    end




    but now I want to use there more HX711 on port b2 to port b7

    Thanks

  • BASCOM-AVR : HX711 : REPLY



    - you should start with the code you have for 1 device.
    - then show us which pins you have for the other 3 devices.

  • BASCOM-AVR : HX711 : REPLY



    there are multiple solutions.
    the most simple would be when you use a full port for example PORTB.
    Say portb.0 and portb.1 for the first device, portb.2 and portb.3 for the next, etc.

    code becomes :

    [code:1:e439bf5711] For Hx711count = 23 To 0 Step -1 'Extract 24-bit data.
    Set PORTB.0 'clock of first device
    SET PORTB.2 'clock of second device
    SET PORTB.4
    SET PORTB.6
    Waitus 1 'Period of [H]. (T3 = 1uS)
    Hx711ad1.hx711count = PINB.1
    Hx711ad2.hx711count = PINB.3
    Hx711ad3.hx711count = PINB.5
    Hx711ad4.hx711count = PINB.7
    Reset PORTB.0
    Reset PORTB.2
    Reset PORTB.4
    Reset PORTB.6
    Waitus 1 'Period of [L]. (T4 = 1uS)
    Next Hx711count
    [/code:1:e439bf5711]


    this is just a partial sample to show the idea where you perform the operations on 4 devices at once. this also requires 4 variables to contain the data.
    you could also make a sub routine where you pass the bit numbers of the port.

    and you can simple copy the code and then assign 4 different ports as the author suggested.

  • BASCOM-AVR : HX711 : REPLY



    I am aware of Gosub but where in my code should I insert Gosub Hx711get1, Gosub Hx711get2, Gosub Hx711get3 abd Gosub Hx711get4.
    I am aware of the principle of Basic since the 80's with CBM64 but Bascom Basic is more advanced Basic than what I learned then.
    I really need this gadget that reads all 4 weights one by one.

    I speak only Norwegian and google English smile

  • BASCOM-AVR : dim Jbit as bit : REPLY



    ...or in other words

    [code:1:c415f362ec]dim A as Bit
    dim B as Bit
    dim C as Bit
    dim D as Bit

    ' and optional for Testing:
    dim BitContainer as byte at A overlay[/code:1:c415f362ec]

    is equivalent to

    [code:1:c415f362ec]dim BitContainer as byte

    A alias BitContainer.7
    B alias BitContainer.6
    C alias BitContainer.5
    D alias BitContainer.4[/code:1:c415f362ec]

  • BASCOM-AVR : dim Jbit as bit : REPLY



    Hi JP
    You can always split the byte in to individual bits, just add the dot and individual bit number.
    Very useful for all sorts of flags and help bits.

    So for example if you declare:
    [code:1:3156f34d66]
    Dim flags as byte
    flags.0 =1
    flags.1 =1
    flags.3 =1

    flags=0'reset all

    'or the same with Bits
    flags=bits (0,1,3)


    [/code:1:3156f34d66]
    Regards
    Pawel

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

Password:




[ ]
[ ]
Headlines

»BASCOM-AVR : dim Jbit as bit : REPLY
hi Laborate, Spiczu, Dave sometimes it's good to revise the fundamentals and appreciate your help, the Bascom community is ver...
»BASCOM-AVR : HX711 : REPLY
Yes, I think it takes some effort. The coefficient calculation of the program changes depending on the power supply voltage (AV...
»BASCOM-AVR : HX711 : REPLY
Thanks. I understand simple basic programming but this is too complicated for an old man like me and therefore I wants lots of he...
»BASCOM-AVR : HX711 : REPLY
If the questioner has a high level of programming, we can also suggest simplifying the program. For example, the [PD_SCK] pin is ...
»BASCOM-AVR : HX711 : REPLY
I use this code when I have only one HX711 $regfile = "m8def.dat" $crystal = 3686400 $baud = 9600 $hwstack = 64 $...
»BASCOM-AVR : HX711 : REPLY
- you should start with the code you have for 1 device. - then show us which pins you have for the other 3 devices. ...
»BASCOM-AVR : HX711 : REPLY
there are multiple solutions. the most simple would be when you use a full port for example PORTB. Say portb.0 and portb.1 for t...
»BASCOM-AVR : HX711 : REPLY
I am aware of Gosub but where in my code should I insert Gosub Hx711get1, Gosub Hx711get2, Gosub Hx711get3 abd Gosub Hx711get4. I...
»BASCOM-AVR : dim Jbit as bit : REPLY
...or in other words [code:1:c415f362ec]dim A as Bit dim B as Bit dim C as Bit dim D as Bit ' and optional for Testing: ...
»BASCOM-AVR : dim Jbit as bit : REPLY
Hi JP You can always split the byte in to individual bits, just add the dot and individual bit number. Very useful for all sor...


Date published: not known
Details

»Unerklärlicher Fehler, komme einfach nicht weiter.
Hallo, ich habe hier ein Projekt, wo zwei Servomotoren zwei Pneumatikzylinder betätigen. Das lief bisher auch viele Tage ohne Probleme. Da aber di...
»EEPROM 24FC1025
BASCOM-Quellcode (56 Zeilen)Hallo Freunde, mit meiner Function und meinem Sub kann ich wunderbar jede Zelle meiner TWI EEPROMS von der 24Cxx Reihe...
»Neu hier und eine Frage zur Servoansteuerung
Hallo Forum, ich klopfe hier mal dreimal auf den Tisch *klopf, klopf, klopf* und gebe ein anerkennendes "Hallo" in die Runde! Ich bin schwer beein...
»Ein CO-Warner mit MQ-7 und ATtiny45
Man liest immer mal wieder über Kohlenmonoxidvergiftungen. Da es heutzutage doch Sensoren für praktisch alles gibt, sollte es doch kein Problem sei...
»Probleme mit einem Board "Mini MEGA 2560 Pro Micro USB CH340G ATMEGA2560-16AU For Arduino Mega 2560 R3"
Hallo zusammen, ich habe mir ein kleines Board mir der Bezeichnung "Mini MEGA 2560 Pro Micro USB CH340G ATMEGA2560-16AU For Arduino Mega 2560 R3" ...
»PWM mit ATtiny85 will nicht
Hallo, ich versuche mich mit PWM beim ATtiny85. Aber leider tut sich beim Motor nix. Um den Fehler einzugrenzen, habe ich das Programm komplett in...


Date published: Sat, 23 Jan 2021 18:31:26 +0000
Details

»93c46 editor programmer bascom &amp; vb93c46 editor programmer bascom &amp; vb
»93c46 Bascom &amp; VB693c46 Bascom &amp; 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 &amp; date at power onIV-17 Nixie clock GPS set time &amp; 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.