Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

SPI stop to work when LCD is added

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
pinkfloyd11

Bascom Member



Joined: 02 Jul 2007
Posts: 248

italy.gif
PostPosted: Wed Mar 11, 2015 9:54 am    Post subject: SPI stop to work when LCD is added Reply with quote

Hello

I'm developing an spi monitor and simulate it in proteus 8.1 sp1.

In debug mode, on slave cpu, you can see the tipical hello world string be received correctly (see CHAR variable).

If I add LCD configuration code, trasmission from SPI end to work.

Have you any idea why happen this?

Thanks

(BASCOM-AVR version : 2.0.7.8 )
Back to top
View user's profile
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Wed Mar 11, 2015 2:12 pm    Post subject: Show the Bascom-code Reply with quote

Show us the Bascom-code

Ben Zijlstra
Back to top
View user's profile Visit poster's website
pinkfloyd11

Bascom Member



Joined: 02 Jul 2007
Posts: 248

italy.gif
PostPosted: Wed Mar 11, 2015 2:49 pm    Post subject: Reply with quote

it is inside the project but for semplicity i will copy here:



//////////////////////////////////////////////////////
' SPI MASTER
'//////////////////////////////////////////////////////

$regfile = "m328pdef.dat"
$crystal = 16000000
$baud = 57600
$framesize = 128
$hwstack = 40
$swstack = 40

Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = Low , Phase = 0 , Clockrate = 16
SPIINIT

Dim Lunghezza as Byte
Dim Indice As Byte
Dim CHAR As String * 1
Dim Stringa_da_Inviare as String * 11





'////////////////////////////////////////////////
'MAIN
'////////////////////////////////////////////////
'PRINT "SPI MASTER"

Stringa_da_Inviare = "Hello World"
Lunghezza = Len(Stringa_da_Inviare)

For Indice = 1 To Lunghezza
CHAR = Mid(Stringa_da_Inviare , Indice , 1)
Spiout CHAR , 1
Waitms 10
Next



Do

Loop
End
'///////////////////////////////////////////////







'_______________________________________________________________________________________








//////////////////////////////////////////////////////
' SPI SLAVE
'//////////////////////////////////////////////////////
$regfile = "m328pdef.dat"
$crystal = 16000000
$framesize = 128
$hwstack = 40
$swstack = 40


'//////////////////////////////////////////////////////////////////////
'CONFIGURAZIONE LCD
'//////////////////////////////////////////////////////////////////////
'Config PORTC = Output
'Config LCDPIN = Pin , Db4 = PORTC.2 , Db5 = PORTC.3 , Db6 = PORTC.4 , Db7 = PORTC.5 , E = PORTC.1 , Rs = PORTC.0
'Config Lcd = 16x2
'Cursor Off
'//////////////////////////////////////////////////////////////////////



'//////////////////////////////////////////////////////////////////////
'CONFIGURAZIONE SPI
'//////////////////////////////////////////////////////////////////////
Config Spi = Hard , Interrupt = On , Data Order = Msb , Master = No , Polarity = Low , Phase = 0 , Clockrate = 16
SPIINIT
ON SPI SPI_IRS
ENABLE INTERRUPTS
'//////////////////////////////////////////////////////////////////////


Dim CHAR As String *1
Dim Received_Bytes As Byte


'CLS

'//////////////////////////////////////////////////////////////////////
'//////////////////////////////////////////////////////////////////////
'MAIN
'//////////////////////////////////////////////////////////////////////
'//////////////////////////////////////////////////////////////////////
DO

LOOP
'//////////////////////////////////////////////////////////////////////
'//////////////////////////////////////////////////////////////////////




'_______________________________________________________________________________________
SPI_IRS:

SPIIN CHAR, Received_Bytes
'LCD Char


Return
Back to top
View user's profile
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Wed Mar 11, 2015 4:27 pm    Post subject: quick question Reply with quote

Jtag disabled?
Back to top
View user's profile Visit poster's website
pinkfloyd11

Bascom Member



Joined: 02 Jul 2007
Posts: 248

italy.gif
PostPosted: Wed Mar 11, 2015 4:58 pm    Post subject: Reply with quote

How do it?
I'm simulate under Proteus
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum