I ordered 30 of them, for about 0,2 USD per screen)))) SE T-100 screens cost the same, but it is 8-bit parallel interface, i ordered couple of them, and try them soon. I allready adapt you library for this screen, but i redraw fonts, and make other SED image converter. Tomorrow i wil post all i have. It will be nice if you help me to write new character and showpicture procedures.
↧
Share your working BASCOM-AVR code here : Motorola-C115 and V180 libraries : REPLY
↧
BASCOM-ARDUINO : Arduino Nano with I2c LCD and backlight : REPLY
Hi bzijlstra, thank you for the answer.
I found the base address with an I2C scan.
There is the following LCD_BACKLIGHT variable in the library:
*Basic: lcd_backlight = 1
Just in case I stripped down the example code for Arduino nano but I get the same errors, I should be missing something trivial.
[code:1:161d36bb64]
'I2c LCD on Arduino Nano 16x2 display with backlight
$regfile = "M328pdef.dat" ' the used chip
$crystal = 8000000 ' frequency used
$baud = 9600 ' baud rate
Config I2cdelay = 10
$lib "bl_Lcd_i2c.lib"
Const Pcf_d4 = 4
Const Pcf_d5 = 5
Const Pcf_d6 = 6
Const Pcf_d7 = 7
Const Pcf_rs = 0
Const Pcf_rw = 1
Const Pcf_e1 = 2
Dim B As Byte
Dim A As Byte
Dim _lcd_e As Byte
Dim Backlight As Byte
Backlight_on Alias &H08
Backlight_off Alias &H00
Backlight = Backlight_on
_lcd_e = 128
Const Pcf8574_lcd = &H7E 'Defines the address of the I/O expander for LCD
Config Scl = Portd.3 'we need to provide the SCL pin name
Config Sda = Portd.4
I2cinit
Wait 2
Cls
Home
Lcd "i2c-display" 'display this at the top line
End
[/code:1:161d36bb64]
Error : 46 Line : 41 Assignment error, unknown variable (DIM) [LCD_BACKLIGHT: 0 1: 112]
Error : 5 Line : 41 No more space for BIT [LCD_BACKLIGHT]
Error : 320 Line : 41 [syntax error, token = '{']
](*,)
↧
↧
BASCOM-AVR : Problem with Arduino Mega2560 and Ethernet Shield (W5100) : REPLY
The first thing I noticed, you should increase $stacks en $framesize.
Check on other examples.
Have fun
Ben Zijlstra
↧
BASCOM-ARDUINO : Arduino Nano with I2c LCD and backlight : REPLY
Still missing the second $lib call compared to the first example in the tread.
Have fun
Ben Zijlstra
↧
BASCOM-ARDUINO : arduino mega (2560) + ethernet shield(Wiz5500) @ bascom 2.0. : REPLY
My two cents...
Do you remove your programming cable after flashing?
I read that you are using the STK500 icsp cable. That is connectrd to Mosi / Miso and CLK.
Ben Zijlstra
↧
↧
BASCOM-AVR : Problem with Arduino Mega2560 and Ethernet Shield (W5100) : REPLY
Hello Mark, thank you very much for your quick response. Probe your suggestions regarding stack and NOINT but nothing changes. Then probe the PING_SPI.BAS and if it worked, later probe the UDP_SWITCH_SPI_MEGA.BAS and it did not work either. In all cases do the same as I said in my previous post. For the doubts also change the whole HARD but nothing change, it would seem that the problem is when it reads UDP because in the example PING_SPI.BAS uses Udpwrite and it works.
Also run another application that developed some time ago and does not work. It's very strange, I wanted to try with an earlier version of BASCOM but I do not have any.
Hope someone can help me.
Best regards.
↧
BASCOM-ARDUINO : Arduino Nano with I2c LCD and backlight : REPLY
If you mean
$lib "i2c_twi.lib"
I use software TWI, I shouldn't need it
$hwstack, $swstack and $framesize: I haven't understood yet how to set them up but eventually I will learn :D
I am using Bascom 2.0.7.8
↧
BASCOM-ARDUINO : Arduino Nano with I2c LCD and backlight : REPLY
I hope you understand that the
Backlight_on= &h08
Backlight_off = &h00
Are aliases. It shall be OR'ed with what should go on the in-output pins of the PCF8574 on the small PCB. &h08 will put a 1 in the 4th pin of the PCF8574.
I see no
Backlight = Backlight_on
or
Backlight = Backlight_off
Some LCD command should trigger going to the library so perhaps you can add CLS to your two LCD commands.
If you don't fill backlight it will stay 0 and your backlight will stay off.
Could you give it a try?
Ben Zijlstra
↧
BASCOM-AVR : INA219 Problem with reading : NEWTOPIC
Hello.
I have a program for reading current and voltage from INA219.
There is some error in the program because it reads from the INA219 system only 0.
Will someone help me find a bug?
[list:21598174c3]
'-------------------------------------------------------------------------------
' SSD1306
' BASCOM-AVR - Mrshilov 2015
'===============================================================================
$regfile = "m328pdef.dat"
$crystal = 8000000
$hwstack = 128
$swstack = 128
$framesize = 128
Config Clockdiv = 1
'-------------------------------- I2C bus --------------------------------------
$lib "i2c_twi.lbx" ' hardware I2C
Config Scl = Portc.5 ' used i2c pins
Config Sda = Portc.4
Config Twi = 400000 ' i2c speed
I2cinit
Waitms 5
'________________________________INA219_________________________________________
Const Ina219_adr_w = &H80 ' Adres zapisu INA219
Const Ina219_adr_r = &H81 ' Adres odczytu INA219
Dim Ina219_reg As Byte ' Register
Dim W As Word
Dim W_low As Byte
Dim W_high As Byte
Dim I As Integer , I1 As Integer
Dim I_low As Byte
Dim I_high As Byte
Dim Napiecie As Single
Dim Prad As Single
'-------------------------------- Display --------------------------------------
$lib "glcdSSD1306-I2C-Buf.lib"
Config Graphlcd = Custom , Cols = 128 , Rows = 64 , Lcdname = "SSD1306"
Dim Lcd_auto As Byte
Lcd_auto = 1
Const Rotate_180 = 0
#if _build < 20784
Dim ___lcdrow As Byte , ___lcdcol As Byte ' dim these for older compiler versions
#endif
'============================== Program ========================================
W = &B0001011111111111 ' Register 00h, 12 Bit, 128 Samples, Bus Voltage Range 16 V, PG 160 mV
Ina219_reg = &H00 ' Configuration Register
Gosub Ina219_reg_write ' Register INA219 schreiben
'W = 8192 ' Calibration Register Value
W = 7880 ' Optional second Calibration step
Ina219_reg = &H05 ' Calibration Register
Gosub Ina219_reg_write ' Register INA219 schreiben
Showpic 0 , 0 , Logo
Wait 1
Cls
Do
Gosub Ina219_reg_read_w ' Register INA219 lesen
W = Makeint(w_low , W_high)
Shift W , Right , 3 ' must bee shifted right by three bits
'W = W + 6 ' Offset
Napiecie = W / 250 ' Spannung Ausgang 3,3 Volt (4 mV pro Bit)
Gosub Ina219_reg_read_i ' Register INA219 lesen
I = Makeint(i_low , I_high)
'I = I - 7 ' Offset
Prad = I / 100
Showpic 0 , 0 , Full
Setfont Font8x8tt
Lcdat 0 , 40 , "USB"
Lcdat 1 , 40 , "OUT"
Setfont Font16x16
Lcdat 0 , 65 , "5.0V"
Lcdat 3 , 35 , Prad ; "A"
Setfont Font8x8tt
Lcdat 6 , 40 , "REG"
Lcdat 7 , 40 , "OUT"
Setfont Font16x16
Lcdat 6 , 80 , Napiecie
Loop
Ina219_reg_read_w: ' Register INA219 lesen
I2cstart ' send start
I2cwbyte Ina219_adr_w ' send write address
I2cwbyte &H02 ' send register pointer
I2crepstart
I2cwbyte Ina219_adr_r ' send read address
I2crbyte W_high , Ack ' read MSB
I2crbyte W_low , Nack ' read LSB
I2cstop
Return
Ina219_reg_read_i: ' Register INA219 lesen
I2cstart ' send start
I2cwbyte Ina219_adr_w ' send write address
I2cwbyte &H04 ' send register pointer
I2crepstart
I2cwbyte Ina219_adr_r ' send read address
I2crbyte I_high , Ack ' read MSB
I2crbyte I_low , Nack ' read LSB
I2cstop
Return
Ina219_reg_write: ' Register INA219 schreiben
I2cstart ' send start
I2cwbyte Ina219_adr_w ' send write address
I2cwbyte Ina219_reg ' Calibration Register
I2cwbyte W_high ' write MSB
I2cwbyte W_low ' write LSB
I2cstop
Return
End 'end program
'-------------------------------------------------------------------------------
$include "font8x8TT.font"
$include "Font16x16.font"
Full:
$bgf "battfull.bgf"
Half:
$bgf "batthalf.bgf"
Empty:
$bgf "battempty.bgf"
Batt:
$bgf "battbig.bgf"
Logo:
$bgf "logom.bgf"
[/list:u:21598174c3]
[b:21598174c3][color=red:21598174c3](BASCOM-AVR version : 2.0.7.8 )[/b:21598174c3][/color:21598174c3]
↧
↧
BASCOM-ARDUINO : Arduino Nano with I2c LCD and backlight : REPLY
I managed to get it running:
I modified the line :
Dim Backlight As Byte into Dim Lcd_backlight As Byte
and solved the 3 errors
got rid of
Backlight_on Alias &H08
Backlight_off Alias &H00
as Lcd_backlight accepts 0 or 1
(&H08 is actually the value to write to the Pcf8574 to turn on/off the backilight)
Not needed but added Const Pcf_e2 = 3
[code:1:ec35b63d5a]
$regfile = "M328pdef.dat" ' the used chip
$crystal = 8000000 ' frequency used
Config I2cdelay = 10
$lib "bl_Lcd_i2c.lib"
Const Pcf_d4 = 4
Const Pcf_d5 = 5
Const Pcf_d6 = 6
Const Pcf_d7 = 7
Const Pcf_rs = 0
Const Pcf_rw = 1
Const Pcf_e1 = 2
Const Pcf_e2 = 3
Dim A As Byte
Dim _lcd_e As Byte
Dim Lcd_backlight As Byte
_lcd_e = 128
Const Pcf8574_lcd = &H7E
Config Scl = Portd.3
Config Sda = Portd.4
I2cinit
Waitms 100
Lcd_backlight = 1
Cls
Home
Lcd "i2c-display"
For A = 0 To 10
Lcd_backlight = 1
Locate 2 , 1
Lcd A
Waitms 800
Lcd_backlight = 0
Locate 2 , 1
Lcd " "
Waitms 800
Next
Lcd_backlight = 1
Locate 2 , 1
Lcd "End"
End
[/code:1:ec35b63d5a]
Thank you for the help
Regards,
PF
↧
BASCOM-AVR : INA219 Problem with reading : REPLY
To be sure that you hardware is ok, run the i2cScan sample from your bascom sample directory.
This will show what devices are where on the i2c bus.
↧
BASCOM-ARDUINO : Arduino Nano with I2c LCD and backlight : REPLY
Well done!! The original library was written by Kent and worked also on 20x4 display with two E connections.
Have fun
Ben Zijlstra
↧
BASCOM-AVR : Problem with Arduino Mega2560 and Ethernet Shield (W5100) : REPLY
you need to pay attention to this :
[b:68533b8c9a]Udpreadheader [/b:68533b8c9a]Idx ' read the udp header
#if Showresult
Print
Print Peersize ; " " ; Peeraddress ; " " ; Peerport ' these are assigned when you use UDPREAD
Print Ip2str(peeraddress) ' print IP in usual format
#endif
[b:68533b8c9a] If Peersize > 0 Then[/b:68533b8c9a] ' the actual number of bytes
Print "read" ; Peersize
Temp = Udpread(idx , S(1) , [b:68533b8c9a]Peersize[/b:68533b8c9a]) ' read the result
when using an old UDP sample for the W3100 you need to include the UDPREADHEADER
↧
↧
BASCOM-AVR : INA219 Problem with reading : REPLY
I did an I2C scan. INA219 responded at 128 decimal.
So my address is correct & H80, yes?
↧
BASCOM-AVR : INA219 Problem with reading : REPLY
The program worked.
Note that you must first set up the configuration registers and then read the data.
↧
BASCOM-AVR : RC5 and Attiny45 Problem : NEWTOPIC
I'm trying to make a remote control with RC5. IR works but I get weird results. Initially 'Else' and '35' are working correctly but as soon as I choose on 16 or 17 all go crazy. The program is totally simple, where I'm wrong?
[code:1:8b47a7f15e]
$regfile = "attiny45.dat"
$crystal = 8000000
$hwstack = 20
$swstack = 10
$framesize = 40
$lib "mcsbyte.lbx"
Config Portb.0 = Output
Config Portb.1 = Output
Config Portb.2 = Output
Config Portb.3 = Input
Config Portb.4 = Input
Config Rc5 = Pinb.3 , Wait = 2000
Dim Address As Byte , Command As Byte , Command_old As Byte
Clk Alias Pinb.2
D Alias Pinb.1
Rst Alias Pinb.0
Clk = 0
Rst = 0
Enable Interrupts
Do
Getrc5(address , Command)
If Address = 8 Then
Command = Command And &B01111111
Gosub Readrc5
End If
Loop
Readrc5:
Select Case Command
Case 16 '1. LED
Clk = 0
Rst = 1
Waitms 100
Case 17 '2. LED
Clk = 1
Rst = 0
Waitms 100
Case 35 'NONE
Clk = 0
Rst = 0
Waitms 100
Case Else '1. & 2. LED
Clk = 1
Rst = 1
Waitms 100
End Select
Return
[/code:1:8b47a7f15e]
Thank You in advance
[b:8b47a7f15e][color=red:8b47a7f15e](BASCOM-AVR version : 2.0.7.7 , Latest : 2.0.7.8 )[/b:8b47a7f15e][/color:8b47a7f15e]
↧
BASCOM-AVR Old versions : RC5 and Attiny45 Problem : REPLY
Remove the [b:b987b6ee45]$lib "mcsbyte.lbx"[/b:b987b6ee45] line
and increase your Swstack.
↧
↧
BASCOM-AVR Old versions : RC5 and Attiny45 Problem : REPLY
Thank You very much.
I tried a lot of combinations. I changed all stacks, changed and removed out the value "WAIT" in the statement 'config RC5', removed mcsbyte.lbx, but not working properly.
↧
BASCOM-AVR Old versions : RC5 and Attiny45 Problem : REPLY
Hello kano42
I did some work with remote controls
I wanted a universal receiver
I documented the work here
https://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&t=10989&highlight=infra+red
Then a universal one here
https://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&t=11304&highlight=universal
This may help you
Regards Paul
↧
BASCOM-AVR Old versions : RC5 and Attiny45 Problem : REPLY
And this should be changed
[code:1:6679e599ce]
Clk Alias Pinb.2
D Alias Pinb.1
Rst Alias Pinb.0
[/code:1:6679e599ce]
in
[code:1:6679e599ce]
Clk Alias Portb.2
D Alias Portb.1
Rst Alias Portb.0
[/code:1:6679e599ce]
Remember that pin is IN and port is OUT
↧