Hi,
Well, the manual says at least every 10ms... I wouldn't have expected 2ms either but if that what it takes then that is what it takes. I'm pretty sure THAT part has nothing to do with PBP really, it's just what's needed to have USB working.
As previosuly discussed the amount of time that your SEROUT2 statement takes at a certain baudrate depends on the amount of data. If RPM is 0-9 then you're sendning 3 bytes, if it's 10-99 you're sending 4 bytes, if it's 100-999 you're sedning 5 bytes and so on.
When you DEFINE OSC 20 (and asuming RPM needs 3 bytes) your SEROUT2 PORTD.3, $4054,[16,85,DEC RPM] statement will take 60/9600=6.25ms (+some for processing). If you RUN the PIC at 20MHz but doesn't tell the compiler that you are the compiler thinks it's running at 4MHz and calculates all the internal timing based on that. At 4MHz each cycles is 1us but at 20MHz each cycle is 200ns, the PIC is executing code 5 times faster then the compiler expected, your SEROUT2 statement is not sending at 9600baud, it's sending at 48000baud (or trying to, I don't think it'll actually work). So what previosuly took 6.25ms now only takes 1.25ms - which puts you inside the window for USBERVICE timeout.
Since you are running at 20MHz it's likely that SEROUT2 will work at 19200 or even 38400. At 38400 you're down to ~1.6ms for the above. You will need to check the documentation for your serial LCD if there's a way to change the buadrate. I'd expect some jumpers or dipswitches or perhaps it's software controlled. Do you have a link?
/Henrik.
Bookmarks