Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Simulation

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

Bascom Member



Joined: 08 May 2014
Posts: 15
Location: Rio de Janeiro - Brasil

brazil.gif
PostPosted: Wed Sep 12, 2018 5:50 pm    Post subject: Simulation Reply with quote

I am trying o simulate the example AN#144 - CodeLok AVR.
I read on help file (pg. 86) "When you simulate the Keyboard, it is important that you press/click the keyboard button before simulating the getkbd() line !!!"


103 Do
104 Keyread = Getkbd()
105 If Keyread <> 16 Then Gosub Gotkey


Ok!
I tried to do that many times without success. At all times Keyread = 16 (when no key is pressed 16 will be returned).

Does anyone know what's going on?
Thank you
MOR_AL

(BASCOM-AVR version : 2.0.8.1 )
Back to top
View user's profile
MWS

Bascom Member



Joined: 22 Aug 2009
Posts: 1944

blank.gif
PostPosted: Wed Sep 12, 2018 6:08 pm    Post subject: Re: Simulation Reply with quote

MOR_AL wrote:
Does anyone know what's going on?

'Anyone' would guess that you do it wrong.
Set a breakpoint to line 104, press the desired key, single step with the F8-key to line 105, place the mouse pointer over Keyread, check the status line.

Edit: Edited for more sense Very Happy
Back to top
View user's profile
MOR_AL

Bascom Member



Joined: 08 May 2014
Posts: 15
Location: Rio de Janeiro - Brasil

brazil.gif
PostPosted: Thu Sep 13, 2018 2:32 pm    Post subject: Re: Simulation Reply with quote

MWS wrote:
...
'Anyone' would guess that you do it wrong.
Set a breakpoint to line 104, press the desired key, single step with the F8-key to line 105, place the mouse pointer over Keyread, check the status line.

Edit: Edited for more sense Very Happy


Sorry about my English. English is not my mother language. I am using Google translate with my slight knowledge of English.

I followed your instructions in detail, several times, but it did not work.
I should be having problems with my Bascom-AVR simulador.
For several times the F8 key does not work, its icon has the same problem.
Sometimes by clicking F8 on the instruction line Lcd "WWW.AVR.4MG.COM" Only "W" is printed.

The time invested to use this simulation correctly is being too much. I realize that I should give up using it.

Thank you for responding promptly.
MOR_AL
Back to top
View user's profile
EDC

Bascom Expert



Joined: 26 Mar 2014
Posts: 749

poland.gif
PostPosted: Thu Sep 13, 2018 4:30 pm    Post subject: Reply with quote

PORTB is chosen for keyboard reading but it also in the code description drive the LCD...
Code:
'Config Lcd = 16x2
'Db4 = Portb.0 , Db5 = Portb.1 , Db6 = Portb.2 , Db7 = Portb.3
'Enable = Portd.6 , Rs = Portd.5

Code:

Config Kbd = Portb , Debounce = 40


I think this will cause the mess here.
Even if you add in the code :
Code:
Config Lcdpin = Pin , Rs = Portd.5 , E = Portd.6 , Db4 = Portb.0 , Db5 = Portb.1 , Db6 = Portb.2 , Db7 = Portb.3      
Config Lcd = 16x2
Cursor Off , Noblink

You got same response.

Check what settings you have in the IDE for LCD cause this also can make issues if you dont specify it.

EDIT: 90S2313 is not Attiny2313 do You chose correct one for debuging?
Back to top
View user's profile Visit poster's website
MWS

Bascom Member



Joined: 22 Aug 2009
Posts: 1944

blank.gif
PostPosted: Thu Sep 13, 2018 4:55 pm    Post subject: Re: Simulation Reply with quote

MOR_AL wrote:
I followed your instructions in detail, several times, but it did not work.

You're right. Also I did follow my instructions in detail and it did not work.
But there's nothing wrong about you and me, instead this simulator feature seemingly was lost after an update.
With my current version 2.0.8.1 it does not work, but I tried out the same code on 2.0.7.6 and there it worked as supposed.

This is something for MCS support, write them to get it fixed.
And btw., for simulating such code, include a $SIM in your code, this removes any wait loops and makes simulation much more convenient.
Back to top
View user's profile
MWS

Bascom Member



Joined: 22 Aug 2009
Posts: 1944

blank.gif
PostPosted: Thu Sep 13, 2018 5:12 pm    Post subject: Reply with quote

EDC wrote:
PORTB is chosen for keyboard reading but it also in the code description drive the LCD

The simulator - which it is all about - does not know a certain pin setting for the simulated devices, nor does it care.
A LDC-write is simply redirected to the simulator's display window, a GetKBD() is not executed opcode by opcode, instead with a click of the windows keypad a value is injected into the assigned variable.
Back to top
View user's profile
MOR_AL

Bascom Member



Joined: 08 May 2014
Posts: 15
Location: Rio de Janeiro - Brasil

brazil.gif
PostPosted: Thu Sep 13, 2018 7:11 pm    Post subject: Reply with quote

1 - I used the example as it is in AN # 144 - CodeLok AVR. I did not change anything. Line 29: $Regfile="attiny2313.dat" .
2 On lines 84 (Wait 2) and 87 (Wait 4) the simulation takes a long time. The example does not have $SIM. As I am learning Bascom-AVR, so I did not change anything.
3 - And btw., for simulating such code, include a $SIM in your code, this removes any wait loops and makes simulation much more conveniente. It's ok! I'll do it.
4 - LCD settings...
5 - This is something for MCS support, write them to get it fixed. I contacted MSC Support.

MOR_AL
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