Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

AN #197 - Additional PC Multimedia USB-keyboard/Bascom 2.0.7

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

Bascom Expert



Joined: 05 Jan 2006
Posts: 1571
Location: Basel, Switzerland

switzerland.gif
PostPosted: Thu Mar 27, 2014 1:08 pm    Post subject: AN #197 - Additional PC Multimedia USB-keyboard/Bascom 2.0.7 Reply with quote

Hi,

I'm currently playing with a quick and dirty USB mini Keyboard using the code from AN #197.

When I compile the code under 2.0.7.7 I get a large number of errors/warnings

Code:

Error : 380   Line :   249   Array<>Non Array mismatch [TXSTATE(I),TXSTATE]  , in File : Descriptors.inc
Error : 380   Line :   277   Array<>Non Array mismatch [TXSTATE(3),TXSTATE]  , in File : Descriptors.inc
Error : 380   Line :   282   Array<>Non Array mismatch [TXSTATE(COUNT),TXSTATE]  , in File : Descriptors.inc
Error : 380   Line :   284   Array<>Non Array mismatch [TXSTATE(COUNT),TXSTATE]  , in File : Descriptors.inc
Error : 380   Line :   285   Array<>Non Array mismatch [TXSTATE(2),TXSTATE]  , in File : Descriptors.inc
Error : 380   Line :   287   Array<>Non Array mismatch [TXSTATE(2),TXSTATE]  , in File : Descriptors.inc
Error : 5     Line :   232   No more space for BIT [PERIOD_NUMBER]  , in File :  keyboard V001.bas
Error : 5     Line :   232   No more space for BIT [LAST_PERIOD]  , in File : keyboard V001.bas
Error : 5     Line :   232   No more space for BIT [LAST_PERIOD+1]  , in File :  keyboard V001.bas
Error : 5     Line :   232   No more space for BIT [SHIFT_DELAY]  , in File : keyboard V001.bas
Error : 5     Line :   232   No more space for BIT [SHIFT_DELAY+1]  , in File :  keyboard V001.bas
Error : 320   Line :   232    [syntax error, token = '{']  , in File :  keyboard V001.bas
Error : 320   Line :   232    [syntax error, token = '{']  , in File :  keyboard V001.bas
Error : 320   Line :   232    [syntax error, token = '{']  , in File :  keyboard V001.bas
Error : 320   Line :   232    [syntax error, token = '{']  , in File : keyboard V001.bas
Error : 320   Line :   232    [syntax error, token = '{']  , in File :  keyboard V001.bas
 


I've added the line Config Error = Ignore , 380 = Ignore to the code, it's just the error 5 (bit space) that I don't really understand.

So, does the code still work?

Regards
Ian Dobson

(BASCOM-AVR version : 2.0.7.7 )

_________________
Walking on water and writing software to specification is easy if they're frozen.
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 6198
Location: Holland

blank.gif
PostPosted: Thu Mar 27, 2014 9:51 pm    Post subject: Reply with quote

it is not a good idea to use arrays like shown in the AN. When passing an array, use array(). As you can see the compiler checks if you reference an array, if an array was passed.
ignoring the error is not a good idea in this case. you can add $notypecheck to the code. In that case, the compiler ignores these kind of errors. I would recommend to update the code. But as a quick 'fix' adding $notypecheck will do the trick as well.

_________________
Mark
Back to top
View user's profile Visit poster's website
i.dobson

Bascom Expert



Joined: 05 Jan 2006
Posts: 1571
Location: Basel, Switzerland

switzerland.gif
PostPosted: Thu Mar 27, 2014 9:57 pm    Post subject: Reply with quote

Hi,

Thanks for the answer, I'll try patching the code when I get the time/when I know the Hardware is working. until then I'll just use $notypecheck.

Regards
Ian Dobson

_________________
Walking on water and writing software to specification is easy if they're frozen.
Back to top
View user's profile
i.dobson

Bascom Expert



Joined: 05 Jan 2006
Posts: 1571
Location: Basel, Switzerland

switzerland.gif
PostPosted: Fri Mar 28, 2014 7:34 pm    Post subject: Reply with quote

Hi,

OK, I've banged up a simple board and unfortunatly it's not working very well. When I plug the board into an USB port a new device is seen but it's almost always "unknown". I've checked the board/fuse Settings and all the usual things and evyrthing Looks OK. The only thing I can see is that the voltage on D+ and D- is only about 2.2-2.4Volt. I would expect it to be about 3.6Volt (Over the zener diode). I'm using BZV85C3V6 zener diodes (http://www.datasheets360.com/pdf/5667260554674975242).

I have a feeling the zeners I'm using are incorrect but I can't understand why. I used these zeners as that's what I found first in my "junk box".
The board layout is the same as the AN.

Regards
Ian Dobson

_________________
Walking on water and writing software to specification is easy if they're frozen.
Back to top
View user's profile
Petr_

Bascom Member



Joined: 24 Mar 2010
Posts: 66

blank.gif
PostPosted: Fri Mar 28, 2014 9:36 pm    Post subject: Reply with quote

Fixed code and it compiles without errors in version 2.0.7.7.

But there is little strange behavior of the compiler in this piece of code (file Descriptors.inc, lines 288 and 289).
Code:
   Txstate(1)._usb_rtt = 1
   Txstate(1)._usb_txc = 0
Error number 243 and 229.

But if replace a similar code, but with an intermediate variable, no error.
Code:
   Count = Txstate(1)
   Count._usb_rtt = 1
   Count._usb_txc = 0
   Txstate(1) = Count
What is the reason of such strange behavior of the compiler?
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 6198
Location: Holland

blank.gif
PostPosted: Fri Mar 28, 2014 9:59 pm    Post subject: Reply with quote

thanks for the update.
the error you get is because passed arrays do not pass their length and the bit range error check reports an error. i changed it.

_________________
Mark
Back to top
View user's profile Visit poster's website
i.dobson

Bascom Expert



Joined: 05 Jan 2006
Posts: 1571
Location: Basel, Switzerland

switzerland.gif
PostPosted: Sat Mar 29, 2014 9:29 am    Post subject: Reply with quote

Hi Petr_,

Thanks for the code. I'll try it out once I've found more sutable zener diodes.

Regards
Ian Dobson

_________________
Walking on water and writing software to specification is easy if they're frozen.
Back to top
View user's profile
i.dobson

Bascom Expert



Joined: 05 Jan 2006
Posts: 1571
Location: Basel, Switzerland

switzerland.gif
PostPosted: Sat Mar 29, 2014 4:12 pm    Post subject: Reply with quote

Hi,

OK I've loaded the code from petr_ and it's working Smile Thankyou Petr_

As I couldn't find any zener diodes with 3.6Volt I went back to the original AN and used 2 diodes is series to produce 3.6Volt.

Regards
Ian Dobson

_________________
Walking on water and writing software to specification is easy if they're frozen.
Back to top
View user's profile
cicos

Bascom Member



Joined: 14 Mar 2015
Posts: 1

PostPosted: Thu Apr 02, 2015 3:51 pm    Post subject: Reply with quote

Hi,
Does anyone have an explanation Why the compiler reports errors:

Error : 261 Line: 140 Array expected [_USB_TX_STATUS] , in File; C:\USB_Key-Petr_\Multimedia keyboard.bas
Error : 261 Line: 149 Array expected [_USB_TX_STATUS] , in File; C:\USB_Key-Petr_\Multimedia keyboard.bas
Error : 7 Line: 149 IF THEN expected [474] , in File; C:\USB_Key-Petr_\Multimedia keyboard.bas
Error : 123 Line: 149 END IF expected [474] , in File; C:\USB_Key-Petr_\Multimedia keyboard.bas


I tried to compile the source who sent Petr_ and on this occasion we report mentioned error.
I only 6 buttons and the ability to activate an LED so I wanted to slightly modify the program.
I hope you do not mind because the topic of restarting after a year.

I hope that you have the patience to answer.
I apologize to my bad English - Google translator
Regards
Miroslav
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