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

This page ever ...
total: 205
unique: 136

Site ...
total: 3104
unique: 1553
Online
  • Guests: 1
  • 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 : Minor increases in duty cycle values : REPLY



    [quote:96ecddc26e="atmega64"]would be perfect ... how can I do?[/quote:96ecddc26e]
    As I wrote: slow down the main clock and use a prescaler of 1.
    [quote:96ecddc26e][b:96ecddc26e]Clockdivision = 2[/b:96ecddc26e] should do the trick with this controller, however [u:96ecddc26e]everything runs slower then.[/u:96ecddc26e][/quote:96ecddc26e]

  • BASCOM-AVR : ATTiny 2313A Timer0 PWM : NEWTOPIC



    Hello to all,
    since i read in the Datasheet that Attiny 2313A Timer0 has PWM functionality, i'm wondering, why i get error message, using the PWM-statement in Bascom?

    [code:1:5862fb842c]
    config TIMER0 = Pwm, Prescale = 1, Pwm = 8, Compare A Pwm = Clear Down, Compare B Pwm = Clear Down

    [/code:1:5862fb842c]

    Kind regards
    Norbert

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

  • BASCOM-AVR : Minor increases in duty cycle values : REPLY



    Sorry, you are right...

    this is the correct code with fixed frequency 40Khz:

    [code:1:e8915c38b3]
    Tccr2a = &B00100011
    Tccr2b = &B00001010 'Prescaler 8
    Ocr2a = 49 '40KHZ
    Pwm2b = Pwr_pwm_tmp
    [/code:1:e8915c38b3]

    and setting PWR_PWM_TMP = 24, I have this signal:

    [img:e8915c38b3]https://www.mcselec.com/userpix/514_TEK0001_1.jpg[/img:e8915c38b3]

    I therefore have 48 steps ...

    [quote:e8915c38b3]
    For example, if main clock would be 8MHz, a prescaler of 1 and OCR2A of 199 would result in 40kHz with a 200 step range of duty cycle.
    [/quote:e8915c38b3]

    would be perfect ... how can I do?

  • BASCOM-AVR : Minor increases in duty cycle values : REPLY



    [quote:367a718250="atmega64"]to have minor increases in duty cycle values?
    The code I'm using is as follows: [/quote:367a718250]Your code is nonsense.

    [quote:367a718250="atmega64"][code:1:367a718250]Pwm2b = 40 '40KHZ[/code:1:367a718250][/quote:367a718250]Surely not 40kHz.

    While I had no fun to disassemble your binary bit-muddle timer2 configuration, I actually had to for finding out that you use mode 7 of timer2, fast pwm with OCR2A as top.
    Using Dutycycle_tmp to control OCR2A alters thus the frequency, and not duty-cycle at constant frequency.

    If your code would be nothing else than what you show, then Dutycycle_tmp and OCR2A would be zero. OCR2B has no effect at all, as the timer would always count from 0 to reset at 1, a value of 40 would be never reached.
    The formula for this timer mode is: f_OCnx = f_clk_I/O / (prescaler * (1 + OCRnx)) ---> f_OC2B = 16MHz / (8 * (1 + 0)) which calculates to 2MHz.

    If for example OCR2A would be set to the value of 40, the resulting frequency would be 48780Hz, and the duty-cycle could be adjusted with OCR2B within the range of 0 to 40. In case this is to coarse, use a 16bit timer or slow down the main clock, as then a prescaler of 1 would be possible while staying in an 8bit value range.

    For example, if main clock would be 8MHz, a prescaler of 1 and OCR2A of 199 would result in 40kHz with a 200 step range of duty cycle.
    Clockdivision = 2 should do the trick with this controller, however everything runs slower then.

    If such is not desirable, use a prescaler of 8 and OCR2A of 49, you have a 50 step range of duty cycle then.
    And that's the best you can get then.

  • BASCOM-AVR : Minor increases in duty cycle values : NEWTOPIC



    Hi,
    what can I do, to have minor increases in duty cycle values? (That is a finer adjustment of the duty cycle ...)

    The code I'm using is as follows:

    [code:1:628a8ddabc]
    $regfile = "m1284Pdef.dat"
    $crystal = 16000000
    $baud = 19200
    $hwstack = 48
    $swstack = 24
    $framesize = 48

    Dim Dutycycle_tmp As Byte

    Tccr2a = &B00100011
    Tccr2b = &B00001010 'Prescaler 8

    Ocr2a = Dutycycle_tmp

    Pwm2b = 40 '40KHZ

    [/code:1:628a8ddabc]

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

  • BASCOM-AVR : SSD1963 bad colors : NEWTOPIC



    Hi, I use last code and library from this post:
    https://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&p=64606#64606
    This is "Fast library for SSD1963 LCD" by Mrshilov.

    This code "Landscape Test SSD1963.bas" dont work propertly witch my LCD: https://www.aliexpress.com/item/7-0-7-inch-800-480-TFT-Touch-LCD-Module-Display-Screen-Panel-with-PCB-Adapter/32916913295.html?spm=a2g0s.9042311.0.0.298e4c4dnceTBr

    Black screen.

    But when I program it from this code : https://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&t=11500&highlight=ssd1963

    or i Landscape Test SSD1963.bas change initialisation for this:
    [code:1:61d21f2f5a]Sub Ssd1963_init

    Cs_disp = 0
    'Reset
    Lcd_res = 1
    Waitms 50
    Lcd_res = 0
    Waitms 50
    Lcd_res = 1
    Waitms 50

    Call Ssd1963_select_reg(&He2) 'PLL multiplier, set PLL clock to 120M
    Call Ssd1963_write_data(&H0023) 'N=0x36 for 6.5M, 0x23 for 10M crystal
    Call Ssd1963_write_data(&H0002)
    Call Ssd1963_write_data(&H0004)

    Call Ssd1963_select_reg(&He0) 'PLL enable
    Call Ssd1963_write_data(&H0001)
    Waitms 1
    Call Ssd1963_select_reg(&He0)
    Call Ssd1963_write_data(&H0003)
    Waitms 5
    Call Ssd1963_select_reg(&H01) 'software reset
    Waitms 5
    Call Ssd1963_select_reg(&He6) 'PLL setting for PCLK, depends on resolution
    Call Ssd1963_write_data(&H0003)
    Call Ssd1963_write_data(&H00ff)
    Call Ssd1963_write_data(&H00ff)

    Call Ssd1963_select_reg(&Hb0) 'LCD SPECIFICATION
    Call Ssd1963_write_data(&H0027)
    Call Ssd1963_write_data(&H0000)
    Whulp1 = High(hdp) 'Set HDP
    Call Ssd1963_write_data(whulp1)
    Whulp1 = Low(hdp)
    Call Ssd1963_write_data(whulp1)
    Whulp1 = High(vdp) 'Set VDP
    Call Ssd1963_write_data(whulp1)
    Whulp1 = Low(vdp)
    Call Ssd1963_write_data(whulp1)
    Call Ssd1963_write_data(&H0000)

    Call Ssd1963_select_reg(&Hb4) 'HSYNC
    Whulp1 = High(ht) 'Set HT
    Call Ssd1963_write_data(whulp1)
    Whulp1 = Low(ht)
    Call Ssd1963_write_data(whulp1)
    Whulp1 = High(hps) 'Set HPS
    Call Ssd1963_write_data(whulp1)
    Whulp1 = Low(hps)
    Call Ssd1963_write_data(hpw) 'Set HPW
    Whulp1 = High(lps) 'Set LPS
    Call Ssd1963_write_data(whulp1)
    Whulp1 = Low(lps)
    Call Ssd1963_write_data(&H0000)

    Call Ssd1963_select_reg(&Hb6) 'VSYNC
    Whulp1 = High(vt) 'Set VT
    Call Ssd1963_write_data(whulp1)
    Whulp1 = Low(vt)
    Call Ssd1963_write_data(whulp1)
    Whulp1 = High(vps) 'Set VPS
    Call Ssd1963_write_data(whulp1)
    Whulp1 = Low(vps)
    Call Ssd1963_write_data(vpw) 'Set VPW
    Whulp1 = High(fps) 'Set FPS
    Call Ssd1963_write_data(whulp1)
    Whulp1 = Low(fps)

    Call Ssd1963_select_reg(&Hba)
    Call Ssd1963_write_data(&H000f) 'GPIO[3:0] out 1

    Call Ssd1963_select_reg(&Hb8)
    Call Ssd1963_write_data(&H0007) 'GPIO3=input, GPIO[2:0]=output
    Call Ssd1963_write_data(&H0001) 'GPIO0 normal

    Call Ssd1963_select_reg(&H08) 'rotation - Set the read order from frame buffer to the display panel

    'writing from bottom to top
    'Call Ssd1963_write_data(&H0000)
    'writing from top to bottom
    Call Ssd1963_write_data(&H0001)
    'writing from right to left
    'Call Ssd1963_write_data(&H0077)
    'Call Ssd1963_write_data(&H0006)

    Call Ssd1963_select_reg(&Hf0) 'pixel data interface
    Call Ssd1963_write_data(&H0003) '16-bit (565 format)

    Waitms 5

    Call Ssd1963_select_reg(&H29) 'display on

    Call Ssd1963_select_reg(&Hd0)
    Call Ssd1963_write_data(&H000d)
    End Sub
    [/code:1:61d21f2f5a]

    ...LCD display correctly direction and orientation (i test onlu portrait mode), but colors are different.

    I trying to change bit 3 from register 36 of displays (RGB to BGR) but colors still has wrong, and colors are differend.
    For example text witch schould be Red is Black frown

    What can I do more, to LCD colors properly?

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

  • BASCOM-AVR : can bus sleep problem : REPLY



    Thank you Albert for advice. I replace crystal from 16mhz to 4 mhz and seems ok so far, will test more.
    I configure fuse to have 14ck startup time without aditional delay but when I measure time from apply vcc and first instruction(set ouput for can transceiver) I have around 4.2 ms. I use Cksel(3-0) 1101 and sut1=0, sut0=1 and 4mhz crystal.
    Thank you.

  • Share your working BASCOM-AVR code here : Fast library for SSD1963 LCD : REPLY



    Hi and thanks for sharing.

    Last code "Landscape Test SSD1963.bas" dont work propertly witch my LCD: https://www.aliexpress.com/item/7-0-7-inch-800-480-TFT-Touch-LCD-Module-Display-Screen-Panel-with-PCB-Adapter/32916913295.html?spm=a2g0s.9042311.0.0.298e4c4dnceTBr

    Black screen.

    But when I program it from this code : https://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&t=11500&highlight=ssd1963

    LCD display text, but inverted and mirrored...see picture
    [img:4ceaa72b01]https://www.mcselec.com/userpix/16555_ss_1.jpg[/img:4ceaa72b01]

    Now when I change initialisation for this:
    [code:1:4ceaa72b01]Sub Ssd1963_init

    Cs_disp = 0
    'Reset
    Lcd_res = 1
    Waitms 50
    Lcd_res = 0
    Waitms 50
    Lcd_res = 1
    Waitms 50

    Call Ssd1963_select_reg(&He2) 'PLL multiplier, set PLL clock to 120M
    Call Ssd1963_write_data(&H0023) 'N=0x36 for 6.5M, 0x23 for 10M crystal
    Call Ssd1963_write_data(&H0002)
    Call Ssd1963_write_data(&H0004)

    Call Ssd1963_select_reg(&He0) 'PLL enable
    Call Ssd1963_write_data(&H0001)
    Waitms 1
    Call Ssd1963_select_reg(&He0)
    Call Ssd1963_write_data(&H0003)
    Waitms 5
    Call Ssd1963_select_reg(&H01) 'software reset
    Waitms 5
    Call Ssd1963_select_reg(&He6) 'PLL setting for PCLK, depends on resolution
    Call Ssd1963_write_data(&H0003)
    Call Ssd1963_write_data(&H00ff)
    Call Ssd1963_write_data(&H00ff)

    Call Ssd1963_select_reg(&Hb0) 'LCD SPECIFICATION
    Call Ssd1963_write_data(&H0027)
    Call Ssd1963_write_data(&H0000)
    Whulp1 = High(hdp) 'Set HDP
    Call Ssd1963_write_data(whulp1)
    Whulp1 = Low(hdp)
    Call Ssd1963_write_data(whulp1)
    Whulp1 = High(vdp) 'Set VDP
    Call Ssd1963_write_data(whulp1)
    Whulp1 = Low(vdp)
    Call Ssd1963_write_data(whulp1)
    Call Ssd1963_write_data(&H0000)

    Call Ssd1963_select_reg(&Hb4) 'HSYNC
    Whulp1 = High(ht) 'Set HT
    Call Ssd1963_write_data(whulp1)
    Whulp1 = Low(ht)
    Call Ssd1963_write_data(whulp1)
    Whulp1 = High(hps) 'Set HPS
    Call Ssd1963_write_data(whulp1)
    Whulp1 = Low(hps)
    Call Ssd1963_write_data(hpw) 'Set HPW
    Whulp1 = High(lps) 'Set LPS
    Call Ssd1963_write_data(whulp1)
    Whulp1 = Low(lps)
    Call Ssd1963_write_data(&H0000)

    Call Ssd1963_select_reg(&Hb6) 'VSYNC
    Whulp1 = High(vt) 'Set VT
    Call Ssd1963_write_data(whulp1)
    Whulp1 = Low(vt)
    Call Ssd1963_write_data(whulp1)
    Whulp1 = High(vps) 'Set VPS
    Call Ssd1963_write_data(whulp1)
    Whulp1 = Low(vps)
    Call Ssd1963_write_data(vpw) 'Set VPW
    Whulp1 = High(fps) 'Set FPS
    Call Ssd1963_write_data(whulp1)
    Whulp1 = Low(fps)

    Call Ssd1963_select_reg(&Hba)
    Call Ssd1963_write_data(&H000f) 'GPIO[3:0] out 1

    Call Ssd1963_select_reg(&Hb8)
    Call Ssd1963_write_data(&H0007) 'GPIO3=input, GPIO[2:0]=output
    Call Ssd1963_write_data(&H0001) 'GPIO0 normal

    Call Ssd1963_select_reg(&H08) 'rotation - Set the read order from frame buffer to the display panel

    'writing from bottom to top
    'Call Ssd1963_write_data(&H0000)
    'writing from top to bottom
    Call Ssd1963_write_data(&H0001)
    'writing from right to left
    'Call Ssd1963_write_data(&H0077)
    'Call Ssd1963_write_data(&H0006)

    Call Ssd1963_select_reg(&Hf0) 'pixel data interface
    Call Ssd1963_write_data(&H0003) '16-bit (565 format)

    Waitms 5

    Call Ssd1963_select_reg(&H29) 'display on

    Call Ssd1963_select_reg(&Hd0)
    Call[/code:1:4ceaa72b01] Ssd1963_write_data(&H000d)

    Change only this one line (&H36 to &H08):
    [code:1:4ceaa72b01]Call Ssd1963_select_reg([b]&H08[/b]) 'rotation - Set the read order from frame buffer to the display panel [/code:1:4ceaa72b01]

    ...LCD display correctly.

    Next when I copy this initialisation to last code from this subject, LCD start display data, but data is like on this video... https://youtu.be/vz5D1PGGQsA (screen is mirrored)
    LCD display data only when this part of initialization is like on oryginal code:
    [code:1:4ceaa72b01]Call Ssd1963_select_reg([b]&H36[/b]) 'rotation - Set the read order from frame buffer to the display panel [/code:1:4ceaa72b01]

    When &H08 then again black screen.

    What can I do to display normally?

    Working mirrored verion below....

  • Share your working BASCOM-AVR code here : Library for ST7735R display : REPLY



    thanks for this useful addition and sharing it.

  • BASCOM-AVR : channel numbers in variables : REPLY



    xmega has variable uart channels. but there are PB versions like 328PB that have 2 uarts.
    you might check out $serialout and $serialin . you could write some custom code that either handle the HW uart or the SW uart.

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

Password:




[ ]
[ ]
Headlines

»BASCOM-AVR : Minor increases in duty cycle values : REPLY
[quote:96ecddc26e="atmega64"]would be perfect ... how can I do?[/quote:96ecddc26e] As I wrote: slow down the main clock and use a...
»BASCOM-AVR : ATTiny 2313A Timer0 PWM : NEWTOPIC
Hello to all, since i read in the Datasheet that Attiny 2313A Timer0 has PWM functionality, i'm wondering, why i get error messag...
»BASCOM-AVR : Minor increases in duty cycle values : REPLY
Sorry, you are right... this is the correct code with fixed frequency 40Khz: [code:1:e8915c38b3] Tccr2a = &B00100011 Tccr2...
»BASCOM-AVR : Minor increases in duty cycle values : REPLY
[quote:367a718250="atmega64"]to have minor increases in duty cycle values? The code I'm using is as follows: [/quote:367a718250]Y...
»BASCOM-AVR : Minor increases in duty cycle values : NEWTOPIC
Hi, what can I do, to have minor increases in duty cycle values? (That is a finer adjustment of the duty cycle ...) The code I...
»BASCOM-AVR : SSD1963 bad colors : NEWTOPIC
Hi, I use last code and library from this post: https://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&p=6...
»BASCOM-AVR : can bus sleep problem : REPLY
Thank you Albert for advice. I replace crystal from 16mhz to 4 mhz and seems ok so far, will test more. I configure fuse to have...
»Share your working BASCOM-AVR code here : Fast library for SSD1963 LCD : REPLY
Hi and thanks for sharing. Last code "Landscape Test SSD1963.bas" dont work propertly witch my LCD: https://www.aliexpress.com/...
»Share your working BASCOM-AVR code here : Library for ST7735R display : REPLY
thanks for this useful addition and sharing it.
»BASCOM-AVR : channel numbers in variables : REPLY
xmega has variable uart channels. but there are PB versions like 328PB that have 2 uarts. you might check out $serialout and $ser...


Date published: not known
Details

»Einfache DTMF-Schleife erkennt log.10 nicht
Hallo Community, beim Test meiner Decoderboards ist mir aufgefallen, daß im DTMF-Frame die 10 nicht decodiert wird. Den Zweizeiler hänge ich mal un...
»Arduino Mega 2560 mit Adafruit Motor Shield
Hallo, habe mir von MH-Electronics ein Motorshield gekauft. Hat jemand damit Erfahrung gesammelt? Wenn ja interessiert mich die Beschaltung der Pin...
»Befehl Input macht bei 2. Befehl schlapp
Hi, wie der Titel bereits erläutert habe ich (wiedermal ) Probleme, wenn ich über das Terminal Daten an meinen ATmega schicken möchte... Die ers...
»Unbekannte Brücken
Hallo, habe dank der umfangreichen Code-Angebote im Forum mir ein 1,3 Zoll I2C-Oled-Display bei Amazon geholt. Laut Angaben ist VDD 5V, Treiber SSH...
»Attiny 2313a Timer0 PWM
Hallo zusammen, laut Datenblatt hat der Attiny2313a PWM-Funktionalität an Timer0. Wenn ich aber das config-statement so einfüge, bekomme ich eine ...
»adjustment of the duty cycle
Hi, what can I do, to have minor increases in duty cycle values? (That is a finer adjustment of the duty cycle ...) The code I'm using is as follo...


Date published: Tue, 21 May 2019 22:02:04 +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.