View Full Version : FREQOUT compiler error on USB Pic
mindthomas
- 9th March 2008, 19:20
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!
skimask
- 9th March 2008, 22:24
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.
mindthomas
- 10th March 2008, 06:45
Generally, it means you're trying to stuff a WORD variable into a BYTE register.
Ohh, but why? The code line is this:
FREQOUT buzzer,1000,2000 'Freq=262 Hz
Bruce
- 10th March 2008, 10:12
Open your pbppic18.lib and scroll down to line number 1239. Where you see addlw (sintable) change it to addlw low(sintable)
Dave
- 10th March 2008, 10:53
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
Bruce
- 10th March 2008, 11:00
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.
mindthomas
- 10th March 2008, 13:55
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?
skimask
- 10th March 2008, 14:00
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...
mindthomas
- 10th March 2008, 14:38
Word, highbyte, lowbyte, byte1, byte0, and so on...
It's all in the book...
Ya, but when i need to send it over USB?
skimask
- 10th March 2008, 14:44
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
mindthomas
- 10th March 2008, 14:48
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:
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
skimask
- 10th March 2008, 14:52
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?
mindthomas
- 10th March 2008, 14:56
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?
skimask
- 10th March 2008, 15:02
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.
mindthomas
- 10th March 2008, 15:05
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 ;)
skimask
- 10th March 2008, 15:08
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.
mindthomas
- 10th March 2008, 15:34
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 :D
Then i used your code in the PIC and this code in Visual Basic
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!
mindthomas
- 10th March 2008, 17:33
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.
skimask
- 10th March 2008, 17:50
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.
Bruce
- 10th March 2008, 18:20
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]
skimask
- 10th March 2008, 18:29
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...
mindthomas
- 10th March 2008, 18:46
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!
Bruce
- 10th March 2008, 19:03
It may go back a few versions, but I didn't check back any farther than 2.47.
skimask
- 10th March 2008, 19:03
Ohh, it's because i have PBP 2.46!
$25 for the upgrade...
mindthomas
- 11th March 2008, 06:27
$25 for the upgrade...
To what, 2.50?
skimask
- 11th March 2008, 12:49
To what, 2.50?
Yep, 2.50, 32 bit signed variables and a few other upgrades...
Good stuff in my book...
Powered by vBulletin® Version 4.1.7 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.