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

This page ever ...
total: 211
unique: 142

Site ...
total: 3357
unique: 1756
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 : ADC1 & xtiny (ATTINY3217) : REPLY



    Mark, thank you for great support. I have quite some work to do in the meantime. If I will be done before you release the update, then I will ask for beta, otherwise I will wait for the tested update.

  • BASCOM-AVR : ADC1 & xtiny (ATTINY3217) : REPLY



    i got a long way in the mean time.
    At the moment the dat files are updated.
    And after that the help need to be updated for the timers. then its ready.
    if you need it urgent you can write to support (make sure your email is the same as the one used for registration) and you get a beta when ready.

  • BASCOM-AVR : Clock frequency : REPLY



    I agree. And i would not expect the huge offset until i measured it. But when you need very precise timing it is best to use a temp. controlled xtal. also, it is possible to use the RTC. with the internal 32 KHz or external 32 KHz.
    So an exact timing would still be possible. I see these internal osc as a nice extra that was not in the older AVR.
    I think the ones in xmega were better but on the other hand i did not test that lately. so who knows.

  • BASCOM-AVR : Clock frequency : REPLY



    Ok I understood it, I will add it wrong in the model example (see above) three 0 before and I will get the result 0.1181640625. So how AS got the value -7 for SIGROW_OSC20ERR3V. I have measured that the frequency of the oscillator at a correction factor of 23 oscillates at 19.63MHz (when changing to 24 oscillations at 19.6MHz). I don't like when something doesn't work as it should.

  • BASCOM-AVR : ADC1 & xtiny (ATTINY3217) : REPLY



    I see....ATtiny816 only has ADC0...

    I won't dig into registers to run ADC1 as this eats way too much time, I will rather manage other things while waiting for the update shades

  • BASCOM-AVR : Clock frequency : REPLY



    thanks for clearing this up : 0.[000XXXXXXX
    Now it makes sense. i did not think about the fixed zeros.

    the offset works good for baud. in fact :
    [code:1:45fb143445]Config Com1 = 250000 , Mode = Asynchroneous , Parity = None , Databits = 8 , Stopbits = 1 , Baud_offset = Osc20_5v[/code:1:45fb143445]
    the new baud_offset option will read the specified sigrow value and applies the offset.

    i would have preferred a better osc, or a better way to tweak it. the center freq. can not be adjusted to a precise value. but on the other hand, there exist other options.
    ok, all clear cheesey

  • BASCOM-AVR : Clock frequency : REPLY



    The format is stated in the datasheet p.62:
    "The Error is stored as a compressed Q1.10 fixed point 8 bit value, in order not to lose resolution, wherethe MSB is the sign bit and the 7 LSBs the lower bits of the Q.10."

    The number is in fixed point format, where the integer part is fixed to 0, the sign is denoted by bit 7, the remaining 7 bits are the least significant bits of the 10-bit wide fractional part:
    +/- 0.

    To convert to a floating point number: https://en.wikipedia.org/wiki/Q_(number_format)#Q_to_float
    Or, in other words, bit 6 of the register value has a magnitude of 0.0625, bit 5 has 0,03125, ..., bit 0 has 0.001953125.

    So it is a linear factor which can be applied to the baud rate calculation, wait loops, system clock etc. My guess why the user has to do it, is because the hardware implementation of the RC frequency correction is quite coarse, the user could to decide where more accurate calibration is needed (the baud rate calculation has smaller steps). Additionally, the RC temperature calibration is also more application-specific.

    The correction factor is applied in a linear equation (doesn't matter which unit is used for Freq, could be Hz, the baud rate register setting, or something other):
    Freq_corr = Freq * (1 + factor)

    Which translates in fixed point math to (Bascom-like pseudocode):
    [code:1:6fc6abed50]Dim Freq As Integer
    Dim Freq_corr As Integer
    Dim sigrow_val As Integer
    sigrow_val = SIGROW.OSC16ERR3V
    Shift sigrow_val, Left, 8
    Shift sigrow_val, Right, 8, Signed
    Freq_corr = Freq * (1024 + sigrow_val)
    Shift Freq_corr, Right, 10[/code:1:6fc6abed50]

  • BASCOM-AVR : ADC1 & xtiny (ATTINY3217) : REPLY



    you need to wait for the update. the first release only covers the hardware found in xtiny816.
    multiple devices are not supported.
    like i wrote on the add on page 'you can expect some updates'.
    but the good news is that there will be an update for the add on in a few days.

  • BASCOM-AVR : Clock frequency : REPLY



    From the PDF :
    The error is stored as a compressed Q1.10 fixed point 8-bit value, not to lose resolution, where the MSb is the sign
    bit, and the seven LSbs are the lower bits of the Q1.10.

    Q1.10 means you have 1 bit for the integer and 10 bits for the fraction. somehow that will not fit into a byte with also a sign.
    interesting is that they assign it to a short int which is just a signed byte.
    i think they omitted some bits.
    that is why they give this for the baud :
    int8_t sigrow_val = SIGROW.OSC16ERR3V; // read signed error
    int32_t baud_reg_val = 600; // ideal BAUD register value
    assert (baud_reg_val >= 0x4A); // Verify legal min BAUD register
    value with max neg comp
    baud_reg_val *= (1024 + sigrow_val); // sum resolution + error
    baud_reg_val /= 1024; // divide by resolution
    USART0.BAUD = (int16_t) baud_reg_val; // set adjusted baud rate

    i did check and it works. the 1024 is of course 10 bits.

    so similar to this, you could do this with the calib register.
    I tried that but it does not work because even the smallest bit change will result in a huge offset like you noticed too.



    [code:1:2f409e1931]
    Config Sysclock = 20mhz , Prescale = 1 , Clockout = Enabled
    Config Portb.5 = Output 'for the clock output

    'configure the USART
    Config Com1 = 250000 , Mode = Asynchroneous , Parity = None , Databits = 8 , Stopbits = 1 , Baud_offset = Osc20_5v

    Waitms 2000

    Print "Test USART"
    Dim B As Byte

    Do
    Print "this is a baud test"
    Print Hex(clkctrl_osc20mcaliba) '9E
    B = Inkey()
    If B = "+" Then
    Cpu_ccp = &HD8
    Incr Clkctrl_osc20mcaliba
    Elseif B = "-" Then
    Cpu_ccp = &HD8
    Decr Clkctrl_osc20mcaliba
    End If
    Waitms 500
    Loop
    [/code:1:2f409e1931]

    so i think you can not get a precise clock. at least not with the internal osc.
    for a lower frequency such as a baud rate the compensation will work out ok.
    till somebody proves otherwise i leave it as is.

  • BASCOM-AVR : ADC1 & xtiny (ATTINY3217) : NEWTOPIC



    ATtiny3217 has 2 ADCs (ADC0 and ADC1). In xtiny Bascom "Config ADC0" works and "Config ADC1" is not even recognized. How can I now configure ADC1 (I need to read voltage on pin 19 (ADC1/AIN8))?

    "Getadc (n)" command now gives ADC0 value where "n" is from 0 to 11 (mux position). What is the syntax to read from desired pin 19 with ADC1?


    P.S. "Getadc (100)" also compiles with no errors reported....I suppose this is not right isn't it?

    [b:6f865fcd53][color=red:6f865fcd53](BASCOM-AVR version : 2.0.8.3 )[/b:6f865fcd53][/color:6f865fcd53]

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

Password:




[ ]
[ ]
Headlines

»BASCOM-AVR : ADC1 & xtiny (ATTINY3217) : REPLY
Mark, thank you for great support. I have quite some work to do in the meantime. If I will be done before you release the update, ...
»BASCOM-AVR : ADC1 & xtiny (ATTINY3217) : REPLY
i got a long way in the mean time. At the moment the dat files are updated. And after that the help need to be updated for the ...
»BASCOM-AVR : Clock frequency : REPLY
I agree. And i would not expect the huge offset until i measured it. But when you need very precise timing it is best to use a tem...
»BASCOM-AVR : Clock frequency : REPLY
Ok I understood it, I will add it wrong in the model example (see above) three 0 before and I will get the result 0.1181640625. So...
»BASCOM-AVR : ADC1 & xtiny (ATTINY3217) : REPLY
I see....ATtiny816 only has ADC0... I won't dig into registers to run ADC1 as this eats way too much time, I will rather manage...
»BASCOM-AVR : Clock frequency : REPLY
thanks for clearing this up : 0.[000XXXXXXX Now it makes sense. i did not think about the fixed zeros. the offset works good f...
»BASCOM-AVR : Clock frequency : REPLY
The format is stated in the datasheet p.62: "The Error is stored as a compressed Q1.10 fixed point 8 bit value, in order not to l...
»BASCOM-AVR : ADC1 & xtiny (ATTINY3217) : REPLY
you need to wait for the update. the first release only covers the hardware found in xtiny816. multiple devices are not supported...
»BASCOM-AVR : Clock frequency : REPLY
From the PDF : The error is stored as a compressed Q1.10 fixed point 8-bit value, not to lose resolution, where the MSb is the si...
»BASCOM-AVR : ADC1 & xtiny (ATTINY3217) : NEWTOPIC
ATtiny3217 has 2 ADCs (ADC0 and ADC1). In xtiny Bascom "Config ADC0" works and "Config ADC1" is not even recognized. How can I now...


Date published: not known
Details

»Server-Update „überlebt“
Nachdem das Serverupdate geklappt hat und wir weiterhin in diesem sehr guten Forum zusammenkommen können , habe ich in bester Urlaubslaune mal ...
»Einer ist zu doof! BASCOM 2.0.8.2 oder Ich smile
Also ich habe da ein Programm geschrieben. Soweit funktioniert es ja. ABER 1. Warum spring das Programm zu beginn 1x in das Untermenü Taster_auf. o...
»FT800 VM800B EVE Board Farben vertauscht?
Hallo, hat hier schon jemand mit dem FT800 Chip gebastelt? Ich habe das EVE VM800B im Einsatz gehabt, inzwischen defekt und da wollte ich was eig...
»Display 1,4 Zoll 128x128
Hallo Heiko, habe auf anraten ein neues Thema aufgemacht. Gruß Thomas Hier noch mal die Software, das Display hat den ILI9163 Treiber Hier noch ...
»Sensor mit I2C an Atmega 328p, Daten werden nicht übertragen
Hallo zusammen, ich habe einen I2C Sensor VCNL3040 von Vishay, das ist ein optischer Distanz Sensor. Der Sensor ist an einen Atmgea328P angeschlos...
»SUBS werden in der linken Spalte nicht mehr angezeigt
Hallo, ziemlich spontan zeigt mir Bascom nicht mehr die verwendeten SUBS links neben dem Code an. Ich hoffte unter "Options" "Environment" was zu f...


Date published: Fri, 14 Aug 2020 16:34:30 +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.