Hello,
I'm trying to draw big letters 8x12 (display SSD1306 128x64), but instead of drawing vertical draws on the Horizontal.
For Example: Number 1: (&H18,&H38,&H38,&H58,&H18,&H18,&H18,&H18,&H18,&H18 ,&H18,&H7E)
Everything is fine when I use fonts 7x6 Numer 1: (&H00,&H42,&H7f,&H40,&H00,&H00)
Number 1 Vertical (OK)
01234567 (POS Bits X-Y)
00011000 &H18
00111000 &H38
00111000 &H38
01011000 &H58
00011000 &H18
00011000 &H18
00011000 &H18
00011000 &H18
00011000 &H18
00011000 &H18
00011000 &H18
01111110 &H7E
Number 1 Horizontal (BAD)
000000000000
000000000001
000000000001
111111111111
111111111111
011000000001
000100000001
000000000000
const OLED_Address = 78
const OLED_DataCommand = 64
'OLED initialisation
i2cstart
i2cwbyte OLED_Address
i2cwbyte &HAE 'DISPLAY OFF
i2cwbyte &HD5 'SET DISPLAY CLOCKDIV
i2cwbyte &H80 'DISPLAY RATIO '80
i2cwbyte &H1F 'DISPLAY 1/32 DUTY
i2cwbyte &H20 'HORIZONTAL MODE 20
i2cwbyte &H00 'SET DISPLAY STARTLINE
i2cwbyte &H40 'DISPLAY START AT 0
i2cwbyte &HA1 'REMAP 0-127
'i2cwbyte &HA2 'Display up/Down A0 o Abajo A8
i2cwbyte &HC8 'SCAN DIRECTION C8 or C0
i2cwbyte &HDA 'COM PINS
i2cwbyte &H12 'COM PINS 10
i2cwbyte &HA4 ' DISPLAY ON
i2cwbyte &HA6 '$A6=NORMAL MODE;$A7=INVERSE MODE
i2cwbyte &HD9 'set precharge period D9
i2cwbyte &HF1 '$22 - External, $F1 - Internal
i2cwbyte &HDB 'vcomh deselect level
i2cwbyte &H20 'rtfm 20 o 40
i2cwbyte &H8D 'enable charge pump
i2cwbyte &H14 'at 14h = 20d
i2cwbyte &HAF ' DISPLAY ON
i2cstop
----------------------------------------------
Because it can be due.
As I have set it up?.
THX.
↧
Share your working BASCOM-AVR code here : OLED Display using SSD1306 with i2c. Char Mode 16x4 : REPLY
↧
Share your working BASCOM-AVR code here : OLED Display using SSD1306 with i2c. Char Mode 16x4 : REPLY
Sample code initialisation SSD1306:
[code:1:6fa22f59c3] I2cstart #1
I2cwbyte Oled_address , #1
I2cwbyte Oled_command_mode , #1
I2cwbyte &HAE , #1 '10101110 Display off
I2cwbyte &B00000000 , #1 'Set lower column start address for page addressing mode at 0
I2cwbyte &B00010000 , #1 'Set higher column start address for page addressing mode at 0 *
'Set Memory Addressing Mode
'00b, Horizontal Addressing Mode
'01b, Vertical Addressing Mode +++
'10b, Page Addressing Mode (RESET)
'11b, Invalid
I2cwbyte &H20 , #1
I2cwbyte &B00000000 , #1
I2cwbyte &H21 , #1 'Set start and end colomn
I2cwbyte &B00000000 , #1 'Column start address, range
I2cwbyte &B01111111 , #1 'Column end address, range
I2cwbyte &H22 , #1 'Set Start and end page
I2cwbyte &B00000000 , #1 'Page start Address, range
I2cwbyte &B00000111 , #1 'Page end Address, range
I2cwbyte &HB0 , #1 'Set page start address
I2cwbyte &H40 , #1 '01000000 Set display start line at 0
I2cwbyte &H81 , #1 '10000001 Set contrast
I2cwbyte &HFF , #1 '01111111 7F anders
I2cwbyte &HA0 , #1 'Column address is mapped to SEG0 (reset) *
I2cwbyte &HA8 , #1 'Set multiplex ratio *
I2cwbyte &B00111111 , #1 'at 0F = 15 *
I2cwbyte &HD3 , #1 'Set Display Offset
I2cwbyte &H00 , #1 'at 00 = 0
I2cwbyte &HD5 , #1 'Set display clock divide ratio/oscillator frequency
I2cwbyte &B10000000 , #1 'at 80 = 128 anders
I2cwbyte &HD9 , #1 'set precharge period
I2cwbyte &H22 , #1 'at F1 = 241 (22)
I2cwbyte &HDA , #1 'Set COM pins hardware configuration *
I2cwbyte &H02 , #1 'at 02 = 2 *
'I2cwbyte &HDB , #1 'Set Vcomm deselect level at 0.77 x Vcc
'I2cwbyte &H20 , #1 'at 20 = 32
I2cwbyte &HC0 , #1 'Set COM output scan direction in normal C0/C8
I2cwbyte &HA4 , #1 'Display follows the RAM content (A4 - follows/ignores - A5)
I2cwbyte &HA6 , #1 'Normal display, A6/A7 = inversed
I2cwbyte &H8D , #1 'ChargePump Setting * moet
I2cwbyte &H14 , #1 'Enable Charge Pump
I2cwbyte &HAF , #1 '10101111 Display on in normal mode * moet
I2cstop #1[/code:1:6fa22f59c3]
Do not pay attention to the ", #1" - this is for XMega.
↧
↧
BASCOM-AVR : DS2450 with ATTiny and Maxim's One Wire Viewer App : NEWTOPIC
Hello,
Well I programmed a ATTiny45 with the code I posted earlier and I figured the best way to check compatibility is to use Maxim's OneWireViewer
utility to read the device before I try it in my system. I am using the device type/serial number 20 0D CB 0A 00 00 00 EC which is reversed from the byte order when the Maxim program shows it.
It reads the device type and serial number of the device correctly and identifies it as the DS2459 but when I select the A/D Tab to look at the A/D inputs the following appears at the bottom of the OneWireViewer window:
Error initializing viewer!com.dalsemi.onewire.adapter.OneWireException:Invalid CRC16 read from the device.
The DS9490 device works correctly and can see other devices on the bus (like the serial number of the DS9490 and any other 1 wire devices) okay.
I also tried it with the ATTiny DS2450 being the only thing on the bus other than the built in serial number of the DS9490 adapter. This makes no difference I still can's access the A/D.
I am programing the device with the hex file generated bt BascomAVR with a Conitec GALEP-IV and I have tried changing the fuse bits (CKDIV8 and RSTDISBL) and that does not seem to make any difference. The serial data out pin timing seems to be fast at around 59KB instead of 56KB but the DS9490 does report the correct device type and serial number so it the timing were that far off I think that it would garbage that as well. Unfortunately the OneWireViewer dos not display what is bad it only reports it as such.
Any ideas? Anyone have any success with this part?
Sam
[b:bb399eff8d][color=red:bb399eff8d](BASCOM-AVR version : 2.0.7.5 , Latest : 2.0.7.7 )[/b:bb399eff8d][/color:bb399eff8d]
↧
BASCOM-AVR Old versions : Bascom 2.0.7.5 vs. 2.0.7.7 : NEWTOPIC
It seems that the demo is 2.0.7.5 vs the new version is 2.0.7.7
Will the demo get updated to the latest?
What is the difference?
Any changes that affect ATTiny45V parts?
Sam
↧
BASCOM-AVR : How to show subs and labels when working with a project and : NEWTOPIC
Hello all,
Is there a way to have a list of subs/functions as well as labels, show up in .inc files when working with a project? The Main.bas file has some/most of the files, but when working within a specific included file, not the main, none ever show up. How can I fix this?
Thanks to all!
Tim
[b:342d2f2b26][color=red:342d2f2b26](BASCOM-AVR version : 2.0.7.7 )[/b:342d2f2b26][/color:342d2f2b26]
↧
↧
BASCOM-AVR : ADC Reference voltage : REPLY
Thanks Evert, I am using the correct regfile M8535.dat
In the Bascom help file, for the 8535 chip there seems to be only 2 modes: OFF and AVCC but as Paul suggested earlier I can use the internal reference of 2.56V. I measured 2.56V at the AREF pin confirming it to be correct.
Thanks Arera, I restrict my maximum input level so that I can use the byte variable rather than word as the high byte is zero. (ADC Result Registers ADCL is only used). Results are as expected and with sufficient accuracy for the requirement.
cheers
Don
:)
↧
BASCOM-AVR : ADC Reference voltage : REPLY
OK, you know what you are doing!
I thought you expectet to decrease the ADC's resolution from 10 to 8 bit by using a Byte....
↧
BASCOM-AVR : How to show subs and labels when working with a project and : REPLY
Hello Tim
All my subs , functions etc show on the left of my project in the code explorer
Have you set the .bas file as the main so that in the project side it shows as blue?
You may have to reset the the IDE.
Regards Paul
↧
BASCOM-AVR : How to show subs and labels when working with a project and : REPLY
Hi Paul,
Thanks for your reply. The .bas was set main, and is blue. Restarting the IDE cleared up the issue within the main, but I was also hoping to see something similar in each of the include files -for the items that are in the file. Helps to take you right there.
ie when you know that a certain .inc file has the sub/function you want, being able to use the drop down from within the .inc to go right to it would be helpful.
Tim
↧
↧
BASCOM-AVR : How to show subs and labels when working with a project and : REPLY
If you double click on an item eg a sub in the explorer list it takes you to that sub even if its in an .inc file very handy I have found!
Regards Paul
↧
BASCOM-AVR : How to show subs and labels when working with a project and : REPLY
Hi Paul,
Yes, I agree - it is very handy. If each of the includes showed what was in itself, then that would be even more helpful. Otherwise you always have to go back to the main.bas file, find the funct/sub and double click..
Tim
↧
BASCOM-AVR : Set all bytes in an array to a value - is there a way? : NEWTOPIC
Hello all,
I want to set all of the bytes in array RxBuff_StrtPointer and RxBuff_ByteCount to zero. Is there a way to set all bytes in an array to the same value, or is a loop required?
[code:1:f142076e29]
Dim RxBuffer(254) As Byte
Dim RxBuff_StrtPointer(30) As Byte
Dim RxBuff_ByteCount(30) As Byte
[/code:1:f142076e29]
Thanks,
Tim
[b:f142076e29][color=red:f142076e29](BASCOM-AVR version : 2.0.7.7 )[/b:f142076e29][/color:f142076e29]
↧
BASCOM-AVR : Set all bytes in an array to a value - is there a way? : REPLY
After being declared, the array is filled with zeroes.
To do it in the code, you have to use a loop.
↧
↧
BASCOM-AVR : Set all bytes in an array to a value - is there a way? : REPLY
Hi,
Have a look in the help text for memcopy
bts = MEMCOPY(source, target , bytes[ , option])
using Option=2 - only the target address will be increased after each copied Byte
Regards
Ian Dobson
↧
BASCOM-AVR : ADC Reference voltage : REPLY
Hi dongags5,
With regards to the reference voltage, according to the data sheet,
You can choose the internal reference (2.56V) , [b:9492fc9da9]OR [/b:9492fc9da9]the External reference VCC (Chip supply voltage) ,
But you [b:9492fc9da9]CANNOT [/b:9492fc9da9]or should I say [b:9492fc9da9]SHOULD NOT[/b:9492fc9da9] apply an external reference voltage and choose the internal reference via the switches.
This will have the effect of applying VCC chip supply voltage to the output of an opamp and will possibly destroy the internal reference opamp.
It explains it all in the Analogue reference section of the data sheet. Page 213 on my datasheet.
IF you supply an external Aref, then you MUST choose
[quote:9492fc9da9]Reference = Avcc [/quote:9492fc9da9]
If you choose the internal 2.56V reference, then
[quote:9492fc9da9]Reference =INTERNAL_2.56 [/quote:9492fc9da9] and [u:9492fc9da9]Nothing [/u:9492fc9da9]connected to Vref PIN except maybe a capacitor .[/quote]
See attached is a snippet from the sheet.
As far as reading the data, the number you read is [b:9492fc9da9]NOT a voltage[/b:9492fc9da9], it is the number which represents the input voltage divided by the the maximum number of digital bits that the ADC is set up for.
EG: 10bit is 1024 steps
Reading the number from the ADC will result in 1024 for 5V (or what ever you micro supply voltage is) down to 0 ( Zero )with NO input voltage.
512 for 2.5 Volts input etc.
Read page 218 [b:9492fc9da9]ADC Conversion Result[/b:9492fc9da9], this gives you the formula for reading the voltage correctly.
It's up to to convert it to the correct voltage.
Also remember, [b:9492fc9da9]DO NOT apply a voltage greater than you micro supply voltage to the analog input.[/b:9492fc9da9] Even though it's analogue input, it is still only 0 to 5V ( or what ever you micro supply voltage is.)
Regards
Dean
↧
BASCOM-AVR : Set all bytes in an array to a value - is there a way? : REPLY
Have a look at my wiznet web server I do exactly that for a much larger array
All I did was declare a string variable then overlay the bytes on it so
[code:1:4a31f03b1d]
dim rxbuffers as string * 253 'one more byte will be at the end making it 254
dim rxbuffer(254) as byte at rxbuffers overlay
rxbuffers = "" 'clear buffer
[/code:1:4a31f03b1d]
Regards Paul
↧
BASCOM-AVR : Set all bytes in an array to a value - is there a way? : REPLY
[quote:41c794c6ff="Paulvk"]Have a look at my wiznet web server I do exactly that for a much larger array to zero them
[code:1:41c794c6ff]dim rxbuffers as string * 253 'one more byte will be at the end making it 254
dim rxbuffer(254) as byte at rxbuffers overlay
rxbuffers = "" 'clear buffer[/code:1:41c794c6ff][/quote:41c794c6ff]
That's nonsense, only the first byte of the string/array is zeroed, which is enough to declare the string empty.
If all of the bytes of the array have to be reset to a certain state, Ian's suggestion is the way to go.
↧
↧
BASCOM-AVR : Set all bytes in an array to a value - is there a way? : REPLY
If that is so why does is work for the web server when I send the bytes
Note I am not saying you are wrong I was not aware that only the first byte was zeroed
Always willing to learn!
Regards Paul
↧
BASCOM-AVR : Set all bytes in an array to a value - is there a way? : REPLY
Hi,
A string has a 0 as trailing char so Setting the first char to 0 sets the string to "" even if theres "junk" in Memory after it.
Using memcopy to set all Bytes to a value is the same as using a Loop, but as all the code is in the lib (is machine code) it'll be quicker than writing all Bytes in Basic using a Loop.
Regards
Ian Dobson
↧
BASCOM-AVR : Set all bytes in an array to a value - is there a way? : REPLY
This is the problem when you have only yourself to teach you
some of what you learn is only by making an error
Any now I have learnt something to day
but I will now have to look at the send sub and see why it works and learn some more!
Regards Paul
↧