FREQOUT compiler error on USB Pic


Closed Thread
Results 1 to 26 of 26
  1. #1
    Join Date
    Mar 2008
    Posts
    43

    Default FREQOUT compiler error on USB Pic

    I have now got my USB Project working, and i am now working with some sound! (I needed to Comment out some lines in the 18F2550.INC file)

    But now when i use FREQOUT command in my USB script i get this error:
    "Warning[202] \PBP\PBPPIC18.LIB 1239: argument out of range. least significant bits used."

    I don't know what it is, but i think it's somthing with a kind of config!

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mindthomas View Post
    But now when i use FREQOUT command in my USB script i get this error:
    "Warning[202] \PBP\PBPPIC18.LIB 1239: argument out of range. least significant bits used."
    Generally, it means you're trying to stuff a WORD variable into a BYTE register.

  3. #3
    Join Date
    Mar 2008
    Posts
    43


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    Generally, it means you're trying to stuff a WORD variable into a BYTE register.
    Ohh, but why? The code line is this:
    Code:
    FREQOUT buzzer,1000,2000	'Freq=262 Hz

  4. #4
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Open your pbppic18.lib and scroll down to line number 1239. Where you see addlw (sintable) change it to addlw low(sintable)
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  5. #5
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default

    Bruce, What version of PBP do you have there? I just checked my latest version w/patch and find no instance of this.

    Dave Purola,
    N8NTA

  6. #6
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Hi Dave,

    I have the latest version + I keep all older versions for tech support. v2.47 is the version
    I noticed the low missing in. It works even without the mod, but always returns the warning.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  7. #7
    Join Date
    Mar 2008
    Posts
    43


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bruce View Post
    Open your pbppic18.lib and scroll down to line number 1239. Where you see addlw (sintable) change it to addlw low(sintable)
    Thanks.. It worked, and how did you know that?

    Another thing, how can i put two bytes together, because i need to select the FREQUENCE with USB, but i can only go up to 255, so how can i make so i can send a higher value?

  8. #8
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mindthomas View Post
    Thanks.. It worked, and how did you know that?

    Another thing, how can i put two bytes together, because i need to select the FREQUENCE with USB, but i can only go up to 255, so how can i make so i can send a higher value?
    Word, highbyte, lowbyte, byte1, byte0, and so on...
    It's all in the book...

  9. #9
    Join Date
    Mar 2008
    Posts
    43


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    Word, highbyte, lowbyte, byte1, byte0, and so on...
    It's all in the book...
    Ya, but when i need to send it over USB?

  10. #10
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mindthomas View Post
    Ya, but when i need to send it over USB?
    Same thing applies going either sending or receiving...

    variableword var word
    variable_highbyte var byte
    variable_lowbyte var byte

    variableword = (variable_highbyte * 256) + variable_lowbyte
    variable_lowbyte = variableword.lowbyte
    variable_highbyte = variableword.highbyte

  11. #11
    Join Date
    Mar 2008
    Posts
    43


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    Same thing applies going either sending or receiving...

    variableword var word
    variable_highbyte var byte
    variable_lowbyte var byte

    variableword = (variable_highbyte * 256) + variable_lowbyte
    variable_lowbyte = variableword.lowbyte
    variable_highbyte = variableword.highbyte
    In english please
    But look at this:
    Code:
    USBBufferSizeMax   con 8  ' maximum buffer size
    USBBufferSizeTX    con 8  ' input 
    USBBufferSizeRX    con 8  ' output
    
    ' the USB buffer...
    USBBufferIn        Var Byte[USBBufferSizeMax] 
    USBBufferOut        Var Byte[USBBufferSizeMax]
    USBBufferCount   Var Byte 
    
       USBBufferCount = USBBufferSizeTX              ' TX buffer size
       USBService                                    ' keep connection alive
       USBOut 1, USBBufferOut, USBBufferCount, DoOutBuf ' if bus available, transmit data

  12. #12
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mindthomas View Post
    In english please
    That's perfect english...shows how to define a word and a couple of bytes, and how to split them up and join them back together.

    But look at this:
    What about it?

  13. #13
    Join Date
    Mar 2008
    Posts
    43


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    That's perfect english...shows how to define a word and a couple of bytes, and how to split them up and join them back together.


    What about it?
    What about it: It's how the code is used in the USB Script, so how could i get more than only a byte to send? Can you set to bytes together so you can send 255*255?

  14. #14
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mindthomas View Post
    What about it: It's how the code is used in the USB Script, so how could i get more than only a byte to send? Can you set to bytes together so you can send 255*255?
    Well, since the buffer is set up as a bunch of bytes....
    You might...just might, be able to split those 'larger' values, WORDS as they're called (2 bytes, highbyte and lowbyte), and place them into the buffer back to back. And retrieve them in reverse order.

  15. #15
    Join Date
    Mar 2008
    Posts
    43


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    Well, since the buffer is set up as a bunch of bytes....
    You might...just might, be able to split those 'larger' values, WORDS as they're called (2 bytes, highbyte and lowbyte), and place them into the buffer back to back. And retrieve them in reverse order.
    Ohh, so you have a number you save in a WORD, and then split you the WORD up in two BYTES and then you send the BYTES, but can i then get them to one number again in visual basic? And can you also do it the other way, so i have a number higher than 255 would like to have send to the PIC?

    I Hope you can help me, and it would be great if you could make som code examples

  16. #16
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mindthomas View Post
    Ohh, so you have a number you save in a WORD, and then split you the WORD up in two BYTES and then you send the BYTES, but can i then get them to one number again in visual basic? And can you also do it the other way, so i have a number higher than 255 would like to have send to the PIC?
    I Hope you can help me, and it would be great if you could make som code examples
    Read the book...again...search the forums. There's plenty of info out there, more than enough.

  17. #17
    Join Date
    Mar 2008
    Posts
    43


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    Read the book...again...search the forums. There's plenty of info out there, more than enough.
    I have found out... Your code was perfect, i could also just have looked in the book

    Then i used your code in the PIC and this code in Visual Basic
    Code:
    Function LOBYTE(ByVal w As Integer) As Byte
        LOBYTE = w And &HFF
    End Function
    
    Function HIBYTE(ByVal w As Integer) As Byte
        HIBYTE = (w And &HFF00&) \ 256
    End Function
    Just so others can see it, if they maybe need it!

  18. #18
    Join Date
    Mar 2008
    Posts
    43


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bruce View Post
    Open your pbppic18.lib and scroll down to line number 1239. Where you see addlw (sintable) change it to addlw low(sintable)
    How did you know that i should do that?
    Just want to know if it happends again.

  19. #19
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mindthomas View Post
    How did you know that i should do that?
    Just want to know if it happends again.
    If you've got MCS setup to dump out a .lst file with all the options turned on (usually fairly HUGE files), you can usually scroll thru it or search it for the phrase 'ERROR', then using a bit of deductive logic, can usually trace that back to your original problem...whether it be a problem with the typist, an include file, a macro, whatever.

  20. #20
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    How did you know that i should do that?
    The warning message tells you where the problem is. Warning[202] \PBP\PBPPIC18.LIB 1239

    I looked in the library at the line # indicated by the warning message. In v2.50a there was no problem. In v2.47 this was missing, so it's a simple fix to get rid of the warning.

    It also helps if you know assembler...;o]
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  21. #21
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bruce View Post
    The warning message tells you where the problem is. Warning[202] \PBP\PBPPIC18.LIB 1239
    Ya know, I never made the correlation between the 'PBPPIC18.LIB' and the '1239' in the error messages. I always did it the hard way described above.
    Thanks for the tidbit...

  22. #22
    Join Date
    Mar 2008
    Posts
    43


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bruce View Post
    The warning message tells you where the problem is. Warning[202] \PBP\PBPPIC18.LIB 1239

    I looked in the library at the line # indicated by the warning message. In v2.50a there was no problem. In v2.47 this was missing, so it's a simple fix to get rid of the warning.

    It also helps if you know assembler...;o]
    Ohh, it's because i have PBP 2.46!

  23. #23
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    It may go back a few versions, but I didn't check back any farther than 2.47.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  24. #24
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mindthomas View Post
    Ohh, it's because i have PBP 2.46!
    $25 for the upgrade...

  25. #25
    Join Date
    Mar 2008
    Posts
    43


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    $25 for the upgrade...
    To what, 2.50?

  26. #26
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mindthomas View Post
    To what, 2.50?
    Yep, 2.50, 32 bit signed variables and a few other upgrades...
    Good stuff in my book...

Similar Threads

  1. USB CDC Communications for Dummies!
    By Squibcakes in forum USB
    Replies: 104
    Last Post: - 15th January 2014, 13:43
  2. need help! to beginner
    By emilhs in forum mel PIC BASIC Pro
    Replies: 27
    Last Post: - 6th May 2009, 18:44
  3. Reading a slave USB with a pic
    By pcaccia in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 25th October 2008, 12:00
  4. Replies: 15
    Last Post: - 30th October 2007, 19:25
  5. USB PIC without USB Connection
    By Tissy in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 26th December 2005, 17:39

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts