View previous topic :: View next topic |
Author |
Message |
tanus1010
Joined: 29 Jan 2009 Posts: 6
|
Posted: Fri Mar 13, 2009 4:22 pm Post subject: problem with mmc and atmega128 |
|
|
I am using Atmega 128 and mmc.
I have used Lcd on port c . My code is as follows
$regfile = "M128def.dat"
$crystal = 8000000
$swstack = 128
$hwstack = 128
$framesize = 128
'-----------------------------------------------------------------------------------
'-----------------------------------------------------------------------------------
Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = High , Phase = 0 , Clockrate = 4 , Noss = 1
Spiinit
Config Portc = Output
Config Lcd = 16 * 2 'configure lcd screen
Config Lcdpin = Pin , Db4 = Portc.4 , Db5 = Portc.5 , Db6 = Portc.6 , Db7 = Portc.7 , E = Portc.3 , Rs = Portc.2
'----------------------------------------------------------------------------------
'----------------------------------------------------------------------------------
Cls
Waitms 500
Upperline
Lcd "Hello world"
Lowerline
Lcd "lcd working"
'------------------------------------------------------------------------------
$include "CONFIG_AVR-DOS.bas"
$include "Config_MMC.bas"
$lib "Mmc.lbx"
If Gbdriveerror <> 0 Then
Cls
Lcd "Err in Config"
Locate 2 , 1
Lcd Gbdriveerror
End
Else
Cls
Lcd "Config Init."
End If
The LCD shows Hello world and LCd working but nothing after that.
Even I tried to include :
$include "CONFIG_AVR-DOS.bas"
$include "Config_MMC.bas"
$lib "Mmc.lbx"
before printing anything on lcd. In that case, nothing is displayed on the LCD.
Dont know wats the problem. MMC is getting 3.2 volt.
Please help. |
|
Back to top |
|
|
oe9vfj
Joined: 17 Jun 2004 Posts: 269 Location: Austria, Hard
|
Posted: Wed Mar 25, 2009 9:51 am Post subject: |
|
|
The MMC/SD Card uses SPI and you have defined SPI too in your aplication with a different mode (PHASE). I think, BASCOM will take first SPI configuration and work with them, so the MMC/SD will not work, because there is a wrong SPI Configuration for them.
If you need a different SPI Configuration for your Application, check the SOFT-SPI ability of the MMC/SD driver. _________________ regards Josef
DOS - File System for BASCOM-AVR on http://members.aon.at/voegel |
|
Back to top |
|
|
benoit
Joined: 24 Jul 2007 Posts: 177
|
Posted: Sun Mar 29, 2009 7:12 pm Post subject: |
|
|
HI
YES WHAT IS YOUR Config_MMC.bas
COULD YOU POST THE SPI CONFIG of Config_MMC.bas
thank s |
|
Back to top |
|
|
benoit
Joined: 24 Jul 2007 Posts: 177
|
Posted: Sun Mar 29, 2009 7:18 pm Post subject: |
|
|
hi
for information you also got a END statement in the middle of your program in the if then endif condition
If Gbdriveerror <> 0 Then
Cls
Lcd "Err in Config"
Locate 2 , 1
Lcd Gbdriveerror
End <----------------------------here
Else
Cls
Lcd "Config Init."
End If
i don t know how bascom will react at this ? |
|
Back to top |
|
|
benoit
Joined: 24 Jul 2007 Posts: 177
|
Posted: Sun Mar 29, 2009 7:27 pm Post subject: |
|
|
HI
for then end in the if then else it is not a ploblem, it work correctly |
|
Back to top |
|
|
|