Hi both, thanks for the responses. Mark: No bootloader, I use ISP for both the AVRs in this project. The M128 has an externally accessible port while the M8 is socketed so if there is a need to upgrade firmware or troubleshoot I can do so. I did spot the reference to the 2x bit in the 2.0.7.7 history and surmised this was the likeliest contributor but am only now reading up the chip's datasheet to understand the possible consequences. Thank you P_Santos too - I did wonder whether timing is an issue - and prior to posting the example code I tried something similar to your suggestion, and it didn't make any difference to comms with the M8 - but *is* an issue with the live code that communicates with the VNC1L.
What is potentially more confusing is that I have now re-established comms between the M128 and the VNC1L using code that works on both 2.0.8.0 and 2.0.7.6 - but the differences between the two are interesting. I will work up another example and post back in a bit. :)
↧
BASCOM-AVR : USART issues, 2.0.7.6 vs later : REPLY
↧
BASCOM-AVR : over range Compare : REPLY
Hi
Yes , value is a word .
will have a look at your sugestion .
Thanks
Cheers
↧
↧
BASCOM-AVR : Attiny441 PWM ? : NEWTOPIC
Hi,
Please can anybody help with PWM at Attiny441 ? I need on ports TOCC0, TOCC1, TOCC2 to get standard 8 bit PWM
Thanks
[b:9fa0c4f007][color=red:9fa0c4f007](BASCOM-AVR version : 2.0.8.0. , Latest : 2.0.7.8 )[/b:9fa0c4f007][/color:9fa0c4f007]
↧
BASCOM-AVR : USART issues, 2.0.7.6 vs later : REPLY
Okay, so the VNC1L part of the problem is now fully solved and the cause understood. The real code on the M128 includes an initialisation routine that determines whether the subprocessors are connected - and if not, gracefully cuts out their functionality from the rest of execution. They use an Ischarwaitng loop as per P_Santos' suggestion:
[code:1:24d073bb6b]Rxdel = 0 'zero the RX delay counter
Do
If Ischarwaiting(#3) = 1 Then 'check for character from VNC1L
Incr I 'increment string length counter
Rx(i) = Inkey(#3) 'store value in byte array
End If
Waitms 1
Incr Rxdel
Loop Until Rx(i) = &H3A Or Rxdel = 255 'cut out of the loop if we reach end of line or timeout
[/code:1:24d073bb6b]
Because the init routine for the M8 executed first and was failing, the next one was running before the VNC1L had started up and sent its login string. That's all now and I can subsequently ramp the USB interface's baud rate up to 1MBit/sec exactly as I used to - so that much at least is sorted.
It occurs to me that M8 and M128 are talking to each other at 1.5Mbit/sec bitrate (at least according to the code) - but on a 16MHz crystal there is 33% baud rate calc error reported by Bascom. This didn't matter previously as both chips are clocked at 16MHz so any calc error should mutually cancel out. I wonder now whether utilising the double speed mode is resulting in a more accurate baud rate calculation on the M128's side and therefore causing the comms error. Possibly the easiest way for me to test that theory right now is to recompile the M8's code on 2.0.8.0 - as again I will hopefully be in a position where any error cancels out. Will try it and see.
↧
BASCOM-AVR : USART issues, 2.0.7.6 vs later : REPLY
there is a simpler way : remark the U2X? in the dat file.
this will use the old method of calculating the baud.
↧
↧
BASCOM-AVR : Attiny441 Timer0 and Timer2 - PWM : NEWTOPIC
Hi,
During testing PWM at Attiny441 I found out that this code give error:
[code:1:7467d40a36]Config Timer0 = Pwm , Compare A Pwm = Clear Up , Compare B Pwm = Clear Up , Prescale = 8 [/code:1:7467d40a36]
can be written only like this but PWM does not work:
[code:1:7467d40a36]Config Timer0 = Pwm , Prescale = 8 , Compare A Pwm = Clear Up , Compare B Pwm = Clear Up[/code:1:7467d40a36]
and this can not be written in code:
[code:1:7467d40a36]Config Timer2 = Pwm , Compare A Pwm = Clear Up , Compare B Pwm = Clear Up , Prescale = 8 [/code:1:7467d40a36]
Compiling ends with error: "Unknown CONFIG parameter"
[b:7467d40a36][color=red:7467d40a36](BASCOM-AVR version : 2.0.8.0. , Latest : 2.0.7.8 )[/b:7467d40a36][/color:7467d40a36]
↧
BASCOM-AVR : USART issues, 2.0.7.6 vs later : REPLY
Perfect, thanks Mark, that's cracked it. I was wondering if there was a way to do that - I had already explored trying to reset u2x in code.
Now I've got a handle on what the problem was, I can get used to the new features in the IDE and pick the project back up at leisure. Diolch yn fawr, as they say in Wales. :-)
↧
BASCOM-AVR : XMEGA PLL Clock in 2.0.8.0 - Compile error? : NEWTOPIC
This problem is a little difficult to explain.
This code snippet has been used for some time in Bascom versions 2.0.7.8, 2.0.7.9 and 2.0.8.0. The complete program compiles and work properly in all versions when $CRYSTAL = 32MHz.
[code:1:4d04550ae2]$regfile = "xm192a3udef.dat"
$hwstack = 1600
$swstack = 1600
$framesize = 1600
Osc_dfllctrl.0 = 1
Dfllrc32m_ctrl.0 = 1 'enable CALIBRATION
Const Clk_spd = 32
#if Clk_spd = 32
$crystal = 32000000
Config Osc = Disabled , 32mhzosc = Enabled ' 32 MHz enabled
Config Sysclock = 32mhz , Prescalea = 1 , Prescalebc = 1_1 'use 32 MHz
#endif
#if Clk_spd = 24
$crystal = 24000000
Config Osc = Disabled , 32mhzosc = Enabled 'internal 2 MHz and 32 MHz enabled
Osc_pllctrl = &B10_0_00011
' ^ 'Multiplication factor
'00 2mhZ
'10 PLL Source = 32MHz internal Oscillator (divided by 4 in hardware)
Set Osc_ctrl.4 ' PLL enable
Bitwait Osc_status.4 , Set 'Check if PLL is ready
Config Sysclock = Pll , Prescalea = 1 , Prescalebc = 1_1 ' configure the systemclock ---> use PLL
Waitms 2
#endif
#if Clk_spd = 40
$crystal = 40000000
Config Osc = Disabled , 32mhzosc = Enabled 'internal 2 MHz and 32 MHz enabled
Osc_pllctrl = &B10_0_00101
' ^ 'Multiplication factor
'00 2mhZ
'10 PLL Source = 32MHz internal Oscillator (divided by 4 in hardware)
Set Osc_ctrl.4 ' PLL enable
Bitwait Osc_status.4 , Set 'Check if PLL is ready
Config Sysclock = Pll , Prescalea = 1 , Prescalebc = 1_1 ' configure the systemclock ---> use PLL
Waitms 2
#endif
#if Clk_spd = 48
$crystal = 48000000
Config Osc = Disabled , 32mhzosc = Enabled 'internal 2 MHz and 32 MHz enabled
Osc_pllctrl = &B10_0_00110 ' 8MHz clock Source and Multiplication factor = 6 = 48
' ^ 'Multiplication factor
'00 2mhZ
'10 PLL Source = 32MHz internal Oscillator (divided by 4 in hardware)
Set Osc_ctrl.4 ' PLL enable
Bitwait Osc_status.4 , Set 'Check if PLL is ready
Config Sysclock = Pll , Prescalea = 1 , Prescalebc = 1_1 ' configure the systemclock ---> use PLL
Waitms 2
#endif
[/code:1:4d04550ae2]
When the PLL is used for other clock speeds, it compiles and works properly in Bascom versions 2.0.7.8 and 2.0.7.9.
However, in version 2.0.8.0, these two errors are generated when the PLL is used:
[quote:4d04550ae2]Error : 222 Line : 7307 Illegal character [expected (, got '' [_PRDWORD]] , in File : C:UserselmDesktopProShift TestingProShift.02.dev.WF8.1.Feb16.17.bas
Error : 222 Line : -68717 Illegal character [expected (, got '' [_PRDWORD]] , in File : C:PROGRAM FILES (X86)MCS ELECTRONICSBASCOM-AVRLIBMCS.LBX
[/quote:4d04550ae2]
I don't really know where to look in the code to find the statement(s) that may be causing these errors.
Any help would be appreciated.
E
[b:4d04550ae2][color=red:4d04550ae2](BASCOM-AVR version : 2.0.7.8 )[/b:4d04550ae2][/color:4d04550ae2]
↧
BASCOM-AVR : XMEGA PLL Clock in 2.0.8.0 - Compile error? : REPLY
ih,
compile no error in latest bascom version (downloaded yesterday) !
with all xtal settings
result from
[code:1:7c6b3ea237]Const Clk_spd = 48[/code:1:7c6b3ea237]
[quote:7c6b3ea237]Compiler version :2.0.8.0
Compiler build :2.0.8.0.001
IDE version :2.0.8.0.006
Windows OS :Windows 10 Pro
Report : Xmega_xtal_error
Date : 02-27-2017
Time : 05:30:08
Compiler : BASCOM-AVR LIBRARY V 2.0.8.0
Processor : XM192A3U
SRAM : 4000 hex
EEPROM : 800 hex
ROMSIZE : 31FFE hex
ROMIMAGE : 342 hex -> Will fit into ROM
ROMIMAGE : 834 dec
FLASH USED : 0 %
XTAL : 48000000 Hz
Stack start : 5FFF hex
Stack size : 640 hex
S-Stacksize : 640 hex
S-Stackstart : 59C0 hex
Framesize : 640 hex
Framestart : 4D40 hex
Space left : 11542 dec[/quote:7c6b3ea237]
↧
↧
BASCOM-AVR : XMEGA PLL Clock in 2.0.8.0 - Compile error? : REPLY
_PRDWORD was used in older versions.
So i guess you mixed up the libs. You should never mix libs/compilers/IDE.
↧
BASCOM-AVR : XMEGA PLL Clock in 2.0.8.0 - Compile error? : REPLY
Thank-you Mark and Kim.
Downloaded and installed the version 2.0.8.0 now available for download and the issue is RESOLVED! Thank-you.
Previous 2.0.8.0 version:
[quote:b2ef601696]Splash screen: Copyright 1995-2016
Compiler version :2.0.8.0
Compiler build :2.0.8.0.001
IDE version :2.0.8.0.004
[/quote:b2ef601696]
Current 2.0.8.0 version:
[quote:b2ef601696]Splash screen: Copyright as 1995-2017
Compiler version :2.0.8.0
Compiler build :2.0.8.0.001
IDE version :2.0.8.0.006
[/quote:b2ef601696]
Hope this helps.
E
↧
Share your working BASCOM-AVR code here : Proportional Fonts for GLCDs + TrueType Converter : REPLY
[b:fe05bfc10f]Update 1.2[/b:fe05bfc10f]
FontConverter:
- Added a character editor to modify the generated pixel font
- Added .inc font import
- Added pixel conversion threshold for font generation
- Fixed wrong arranged GUI elements when minizing
- Proper handling of underlined fonts
- Removed "Set charset" button
- minor bug fixes
Library:
- updated for Bascom 2.0.8.0
- Lcd_tt_text(): fixed R0 could contain wrong values when the font uses RLE compression, leading to corrupted text after the first character
- Lcd_tt_textwidth(): proper local variable initialisation
br
↧
BASCOM-AVR : little help please with hard spi and tpic8101 ic : NEWTOPIC
Hello
I would like a little help, I am trying to initialise the tpic8101 ic ,knock sensor interface ic, but with out luck
I have try with noss=0 and also with external cs drive from pind5 and delay according the datasheet of the tpic8101 again with out luck.
It is my first time who I try to communicate with spi so maybe I am wrong in my program
$Regfile="m1284pdef.dat"
$Crystal=16000000
$hwstack=40
$swstack=16
$framesize=32
DIM FREQ AS BYTE
DIM GAIN AS BYTE
DIM CH1 AS BYTE
DIM BPASS AS BYTE
DIM TC AS BYTE
FREQ = &B01000101 'CRYSTALL 6MHZ
GAIN = &B10001110 '1 DB
CH1 = &B11100000
BPASS = &B00100111 '6.37KHZ
TC = &B11001010 '100NS
Waitms 1400
CONFIG SPI = HARD,INTERRUPT=OFF,DATA_ORDER = MSB,MASTER = YES,POLARITY = HIGH , PHASE = 0 ,CLOCKRATE = 4 ,NOSS = 0
SPIINIT
CONFIG PIND.6 = OUTPUT 'INT/HOLD
CONFIG PIND.5 = OUTPUT 'CS
start:
RESET PORTD.PD6
WAITUS 15
RESET PORTD.PD5
WAITUS 10
SPIOUT FREQ,1
SET PIND5
WAITUS 10
SET PIND6
WAITUS 10
RESET PORTD.PD6
WAITUS 15
RESET PORTD.PD5
WAITUS 10
SPIOUT GAIN,1
SET PIND5
WAITUS 10
SET PIND6
WAITUS 10
RESET PORTD.PD6
WAITUS 15
RESET PORTD.PD5
WAITUS 10
SPIOUT CH1,1
SET PIND5
WAITUS 10
SET PIND6
WAITUS 10
RESET PORTD.PD6
WAITUS 15
RESET PORTD.PD5
WAITUS 10
SPIOUT BPASS,1
SET PIND5
WAITUS 10
SET PIND6
WAITUS 10
RESET PORTD.PD6
WAITUS 15
RESET PORTD.PD5
WAITUS 10
SPIOUT TC,1
SET PIND5
WAITUS 10
SET PIND6
WAITUS 10
END
Here is the datasheet in page 7 is the spi config
http://www.ti.com/lit/ds/symlink/tpic8101.pdf
Thanks for any help
[b:3e1f9fb2d6][color=red:3e1f9fb2d6](BASCOM-AVR version : 2.0.7.8 )[/b:3e1f9fb2d6][/color:3e1f9fb2d6]
↧
↧
BASCOM-AVR : little help please with hard spi and tpic8101 ic : REPLY
No matter whether NOSS is set, for master mode either the SS-pin needs to be configured as output (level is a don't care then), or if SS set to input, it has to be pulled high.
↧
BASCOM-AVR : little help please with hard spi and tpic8101 ic : REPLY
thank you for the answer I already have config the pin to out i read other thread to this forum and i read the tip.
CONFIG SPI = HARD,INTERRUPT=OFF,DATA_ORDER = MSB,MASTER = YES,POLARITY = HIGH , PHASE = 1 ,CLOCKRATE = 16 ,NOSS = 1
SPIINIT
config pinb.4 = output 'ss
CONFIG PIND.6 = OUTPUT 'INT/HOLD
CONFIG PIND.5 = OUTPUT 'CS
↧
BASCOM-AVR : SSD1306 SPI Oled bgf picture display : REPLY
After some tests I found out that port k of ATMEGA2560 can not be used as D/C pin in Mrshilov SPI code (can be used in hkipniks code).
With that assuption samaller (0,96') display that has SSD1306 controller works well.
Changing Reset time and Initialization sequence in the lib had no impact - still works well.
Example of good pin configuration:
$lib "glcdSSD1306-SPI.lib"
Config Graphlcd = 128x64sed , Si = Portb.2 , Sclk = Portb.1 , A0 = Portb.0 , Rst = Portb.3
Si->SDA
Sclk->SCL
A0->D/C
Rst->RST
Unfortunately bigger display (1,3') with SH1106 controller (very similar to SSD1306) still does not work with Mrshilov SPI code (works with hkipniks code)
Changing Reset time and Initialization sequence in the lib did not help.
My pin configuration:
$lib "glcdSSD1306-SPI.lib"
Config Graphlcd = 128x64sed , Cs1 = Portb.7 , Si = Portb.2 , Sclk = Portb.1 , A0 = Portb.0 , Rst = Portb.3
Cs1->CS
Si->DIN
Sclk->CLK
A0->D/C
Rst->RES
↧
BASCOM-AVR : SSD1306 SPI Oled bgf picture display : REPLY
[quote:988172cb11]Unfortunately bigger display (1,3') with SH1106 controller (very similar to SSD1306) still does not work with Mrshilov SPI code (works with hkipniks code) [/quote:988172cb11]
i dont get it mine lcd is a Sh1106 controller 1.3" and dont have problems with Mrshilov code its muts faster than hkipniks code
here is my code and pin setup (M328P) and works fine
[code:1:988172cb11]'-------------------------------------------------------------------------------
' SSD1306
' BASCOM-AVR - Mrshilov 2016
'===============================================================================
$regfile = "m328Pdef.dat"
$crystal = 8000000
$hwstack = 64
$swstack = 64
$framesize = 64
Config Clockdiv = 1
Mcucr.7 = 1 'Turn OFF JTAG
Mcucr.7 = 1
'-------------------------------- Display --------------------------------------
$lib "glcdSSD1306-SPI.lib"
Config Graphlcd = 128x64sed , A0 = Portb.4 , Si = Portb.3 , Sclk = Portb.2 , Cs1 = Portb.5 , Rst = Portb.1
Const Lcd_remap = 1 ' Default remap = 1, for some models = 2
'DC PB.4
'DI PB.3
'DO PB.2 '
'CS PB.5
'RES PB.1
'gnd gnd '
'vcc +3.3v
Dim I As Byte , N As Byte
'-------------------------------- Program --------------------------------------
Cls
Setfont Font12x16
Do
Lcdat 0 , 30 , "SH1106"
Wait 1
Lcdat 2 , 30 , "4-WIRE" , 1 ' inverse text
Wait 1
Showpic 0 , 0 , Pic
Wait 1
Lcdat 4 , 20 , "CONTRAST" , 0 ' inverse text
For N = 255 To 0 Step - 1 'down contrast
Lcdcontrast N
Lcdat 6 , 52 , N ; " "
Waitms 2
Next N
Wait 1
For N = 1 To 255 'up contrast
Lcdcontrast N
Lcdat 6 , 52 , N ; " "
Waitms 2
Next N
Wait 1
Cls
Loop
End
'===============================================================================
$include "font12x16.font"
Pic:
$bgf "picture.bgf"
[/code:1:988172cb11]
↧
↧
BASCOM-AVR : SSD1306 SPI Oled bgf picture display : REPLY
I also take a look into basic code and today I saw:
[code:1:dda50401cb]Const Driver_typ = 0 'SSD1306 =1 SH1106 =0[/code:1:dda50401cb]
and below in code
[code:1:dda50401cb]#If Driver_typ...
#else
#endif[/code:1:dda50401cb]
So these differences should be taken into account.
↧
BASCOM-AVR : little help please with hard spi and tpic8101 ic : REPLY
It's port not pin
[code:1:fde0c1f62c]
config portb.4 = output 'ss
CONFIG PortD.6 = OUTPUT 'INT/HOLD
CONFIG PortD.5 = OUTPUT 'CS
[/code:1:fde0c1f62c]
Ps and the caps lock of your keyboards is stuck :D
↧
BASCOM-AVR : little help please with hard spi and tpic8101 ic : REPLY
[quote:c906319e17="petros047"]I already have config the pin to out [/quote:c906319e17]
As the shown code in this thread does not care about SS and my magic ball is in repair, I was not able to know.
It's your duty as the one seeking for help to show your actual code, respectively to update it.
As I'm talking about code, if you'd have the courtesy to use code-tags and some code-formatting, it would not look that plain ugly.
Some comments would be nice also.
Beside that, you do not want what your code actually does here:
[code:1:c906319e17]SET PIND5
'...
SET PIND6 [/code:1:c906319e17]
Why Pin at all? Pin is input register, Port output, and PIND5/6 simply is a constant from the dat-file, which in this case is interpreted as register number and thus the nonsense is out in full force.
Well, I've checked, the commands actually aren't ignored and doe something, but not at all what's supposedly desired.
↧