amazing. thanks for the detailed guide.
↧
Share your working BASCOM-AVR code here : All-in-one game board "Gamebuino" : REPLY
↧
BASCOM-AVR : Bascom 2080 / USBASP programmer / ATMEGA328PB : REPLY
attached an update.
↧
↧
BASCOM-AVR Old versions : Read Cypress Flash S25FL164K : REPLY
Thanks Kim for your response.
[code:1:24d274e978]'SPI config
Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = High , Phase = 1 , Clockrate = 4 , Noss = 0
Spiinit
' I am using SS/ pin of Atmega164p i.e. PORTB.4 as CS/ for Flash. i.e. Noss =0 ; ( The NOSS parameter with a value of 1, will not set the SS line to logic 0 when the SPI operation begins.)[/code:1:24d274e978]
I tried sending 3dummy bytes after ABh instruction although the datasheet of the flash I am using(S25FL164K) does not say that is reqd.
The MISO line is high all the time and the SPIIN reads FF. If I send on ABh and no dummy bytes, it is still high all the time.
Hardware connections:
ATMEGA164P (44pin)
MOSI (PORTB.5) to MOSI of flash
MISO (PORTB.6) to MISO of Flash
SCK ( PORTB.7) to SCLk of Flash
SS/(PORTB.4) to CS/ of Flash
Is there anything else I should look in to
↧
BASCOM-AVR Old versions : Read Cypress Flash S25FL164K : REPLY
did you config PORTB.4 as output ?
DDRB.4 =1
↧
Share your working BASCOM-AVR code here : NOKIA-N73 LCD Library : REPLY
Hi Mrshilov,
I am looking datasheet and connector, but can't find PIN1 on connector nor on LCD display. How did you find out which is PIN1 of theLCD and of the connector that solders on PCB?
Best regards
Jure
↧
↧
BASCOM-AVR : Bascom 2080 / USBASP programmer / ATMEGA328PB : REPLY
Hi Mark,
the problems are solved with the new "m328PBdef.dat"
Timer 1 / 3 / 4 works well up to 20 Mhz (external clock) under Bascom 2080 and 2078 also.
Thanks for Your fast help.
best regards
Joachim
↧
BASCOM-AVR Old versions : Read Cypress Flash S25FL164K : REPLY
Thanks Kim
I am able to read the device ID now.
I made Noss=1 in Config SPI, and Used Set and Reset for PORTB.4
↧
BASCOM-AVR : SPI unexpected results - any suggestions please : NEWTOPIC
Hi,
I have 2 mega8 chips running without crystal and have linked the spi cables directly from the hardware ports. They also share 5v and 0v. One is a master, one is a slave. For this test the SS lines are directly connected.
sck -> sck
miso -> miso
mosi -> mosi
ss -> ss
Once every 5 seconds, the master transmits "Hello". The slave sits in a NOP loop and is triggered by the SPI interrupt. The slave displays "Ready" until triggered. It displays the content of the spi transmission for 1 second, then clears the lcd display and ends the interrupt routine back to the loop.
This is what happens...
Init.
Slave displays Ready
1. Master Lights the led, sends Hello and holds the led on for 1 second, then switches off the led and wait 5 seconds....... Slave still displays "Ready"
2. Master led on, send Hello wait 1s, led off, wait 5s ....Slave still displays "Ready"
3. Master led on, send Hello wait1s led off, wait 5s... Slave displays "olleH" for 1 second the cleared the message ("-----")
4. As above ... Slave displays "Hello" for 1 second then clears the display
5. Master as above ... slave does not update the display
6. Master as above ... slave displays "olleH" again
And the sequence continues to repeat nothing, olleH, Hello, nothing.....etc
Master Code
[code:1:2981f73d18]
$regfile = "m8def.dat"
$crystal = 1000000
$hwstack = 32
$swstack = 8
$framesize = 24
config Lcd = 20 * 4
Config Lcdpin = Pin , Rs = PortB.6 , E = PortB.7 , Db4 = PortD.4 , Db5 = PortD.5 , Db6 = PortD.6 , Db7 = PortD.7
Config Portb = &B11100011 'Servos, pwm, switches
'Portb = &B00011100 'Set pull-ups
portb.2=1
portb.3=1
portb.4=1
Config Portc = &B11111111 'LEDs & Lines
Config Portd = &B11111111 ' rxd,txd,int0/1,LCD data 4-7
'Portd = &B00001101 'pull-ups on the track switches
Config Spi = Hard, Interrupt = Off, Data_Order = Msb, Master = Yes, Polarity = high, Phase = 1, Clockrate = 16, Noss = 0
Spiinit
dim s as string * 5
portd=255
s="Hello"
mainloop:
portd.3=0
spiout s,5
wait 1
portd.3=1
wait 5
goto mainloop
end
[/code:1:2981f73d18]
Slave code
[code:1:2981f73d18]
$regfile = "m8def.dat"
$crystal = 1000000
$hwstack = 32
$swstack = 8
$framesize = 24
config Lcd = 20 * 4
Config Lcdpin = Pin , Rs = PortB.6 , E = PortB.7 , Db4 = PortD.4 , Db5 = PortD.5 , Db6 = PortD.6 , Db7 = PortD.7
Config Portb = &B11100011 'Servos, pwm, switches
'Portb = &B00011100 'Set pull-ups
portb.2=1
portb.3=1
portb.4=1
Config Portc = &B11111111 'LEDs & Lines
Config Portd = &B11110010 ' rxd,txd,int0/1,LCD data 4-7
Portd = &B00001101 'pull-ups on the track switches
Config Spi = Hard, Interrupt = Off, Data_Order = Msb, Master = no, Polarity = high, Phase = 1, Clockrate = 16, Noss = 0
Spiinit
on spi spi_isr
Enable SPI
Enable Interrupts
dim var as string * 5
lcd "Ready"
do
nop
loop
end
spi_isr:
spiin var , 5
waitms 50
locate 1,1
lcd var
wait 1
locate 1,1
lcd "______"
return
[/code:1:2981f73d18]
[b:2981f73d18][color=red:2981f73d18](BASCOM-AVR version : 2.0.7.9 , Latest : 2.0.7.8 )[/b:2981f73d18][/color:2981f73d18]
↧
BASCOM-AVR : SPI unexpected results - any suggestions please : REPLY
From Help: "All BASCOM SPI statements are master mode routines." (See CONFIG SPI).
Look to the Samples -> SPI Slave to get an idea how it works.
↧
↧
BASCOM-AVR : SPI unexpected results - any suggestions please : REPLY
Sorry, the setting has the option for Hardware SPI...
MASTER | Selects if the SPI is run in master or slave mode so I presumed this was an option as it is a setting in the config command.
I can't find the samples - are these installed on the PC or online somewhere.
Thanks for your help
David
↧
BASCOM-AVR Old versions : Read Cypress Flash S25FL164K : REPLY
Good
pls post the working code you have
for other users with same issues
↧
BASCOM-AVR : Configuring ports in Xmegas : REPLY
HELO!!
DDRX=0..........INPUT
PULL_UP=PINX=1
DDRX=0..........INPUT
PULL_DOWN=PINX=0
:D :D
↧
Share your working BASCOM-AVR code here : ILI9341 with SW/HW SPI, 8/16 Bit parallel mode : REPLY
[quote:0292300d51="Netzman"]Hi,
- SPI (Soft-/Hardware), 8/16 Bit parallel interface
- ATMega/ATXmega
- Fast assembler-optimized routines
- Backlight control (Digital IO or PWM)
- Screen rotation (4 directions), Standby, Color inversion
- Basic graphics, pictures (fast SRAM-pictures), fixed-font text
[url=http://www.youtube.com/watch?v=eGcUwT6J5nE]Demo video[/url] (with touch screen)
More info & download: [url=http://mat.midlight.eu/wiki/index.php/ILI9341_Library]ILI9341 Library 1.0[/url] (Project from the video is included)
br[/quote:0292300d51]
Excellent work Netzman, saved me a lot of time.
Had one issue with Lcd_text, i could not get it to pass a string. Had to change in the sub, string to "byref" instead of "byval".
Original:
[code:1:0292300d51]Sub Lcd_text(Byval S As String , Byval Xoffset As Word , Byval Yoffset As Word , Byval Forecolor As Word , Byval Backcolor As Word)[/code:1:0292300d51]
Now:
[code:1:0292300d51]Sub Lcd_text(byref S As String , Byval Xoffset As Word , Byval Yoffset As Word , Byval Forecolor As Word , Byval Backcolor As Word)[/code:1:0292300d51]
Not sure if i missed something else but i could not print a string (only constants) on to the LCD with the original library.
And also.. it wont compile on 2.0.8.0 until all assembler is marked with an "!" before the mnemos. I've fixed that but it's also rewritten for my HW so no real use in sharing it.
regards and thanks
/Joakim
↧
↧
EASY TCP/IP : NTP function : NEWTOPIC
Hi,
I'm using the NTP function provided by Micheal (aka Six1) from this post.
http://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&t=11141
I can get the current time from the NTP servers. I had try 3 or 4 different and all work ok.
Well almost :) I can get sync time correctly at first time (after power up).
Then if I sync again after 2 hours I get the same time as before (does not update).
Example:
Power on
Get NTP -> 09:05:21 -> Correct
After 2 hours:
Get NTP -> 09:05:21 -> incorrect -> same as last sync
Power off and on again
Get NTP -> 11:05:21 -> Correct
What i'm doing wrong?
Tks
Joaquim
↧
BASCOM-AVR : Bascom screen resolution : NEWTOPIC
Since I suffered a major issue with my Windows, I re installed Windows and Bascom. In Windows and other programs I have the normal screen resolution, but whenever I start Bascom, the Bascom window is in a very low resolution with big 'fuzzy' fonts.
What to do to get the sharp and crispy Bascom back again?
thanks,
[b:b5ed611f0d][color=red:b5ed611f0d](BASCOM-AVR version : 2.0.7.8 )[/b:b5ed611f0d][/color:b5ed611f0d]
↧
BASCOM-AVR : SPI unexpected results - any suggestions please : REPLY
David,
Samples are in:
USERS/'Your Computer name'/Documents/MCS-Electronics/Bascom-AVR/Samples/
regards
Hubert
↧
BASCOM-AVR : SPI unexpected results - any suggestions please : REPLY
Thanks,
found them here C:UsersUserNameDocumentsMCS ElectronicsBASCOM-AVRSamplesSPI
I don't like it when files are installed in user profiles rather than with the programs.
Now maybe I can sort the SPI out.
Thanks again,
David
↧
↧
EASY TCP/IP : NTP function : REPLY
Got it. In the test code "M128_Protocols_Test.bas" file there was a missing "Enable Interrupts".
The NTP function "Check_Time" compares the "Local _time" with "Ntp_request_time".
"Local _time" var is increased by one in a timer interrupt every second. Since interrupts were not enabled, the timer event never fired, so the var was never increased.
So, same time forever...
Code is ok...
Joaquim
↧
BASCOM-AVR : SPI unexpected results - any suggestions please : REPLY
The - more or less secret - trick for looking to samples is using the menu in Bascom: file -> open -> sample
Of course you can choose either MASTER or SLAVE in config, but the routines like SPIIN an SPIOUT are master - aka spi clock generator - only.
There are no specific slave routines as IMHO this is rarely used by normal Bascom hackers. And receiving a spi message is quite simple. You only have to read the spi data register SPDR (and put back data, if desired) in the isr.
I personal don't like the sample code in spi-slave.bas, as it is using NOSAVE, pushing/popping r24 only and then using normal bascom statements for reading the register and setting a flag. This is potentially dangerous, as you don't know what register are really used and will be used in future. So this seems to be a very old sample. And using $asm .. $end asm is now mandatory.
If you don't have any experience in assembler I would suggest not using NOSAVE and write the isr in basic. As you has control over both sender and receiver code you can easily make sure that the timing will work and you're not loosing data.
↧
BASCOM-AVR : SPI unexpected results - any suggestions please : REPLY
Great, thanks, looking forward to having another go with this.
Just for info, i'm planning on controlling a 16mm railway with it. A master chip will control devices (like automatic turntables, points, signals etc) so having a master that can send instructions to multiple devices with selective SS lines seems to be a good solution.
Many thanks again,
David
↧