On 11/14/09, Wayne <[email protected]> wrote:
>
>
> vasile surducan wrote:
> > If you are using the hardware UART, there are some computations which
> tell's
> > you the error for various crystals. Take a deep look to the Stef's "usart
> > common.jal" from the distribution pack and to the microcontroller
> datasheet
> > USART section, you will find the formula for error detection and spbrg
> > computation. But 9600bps must work with 4MHz crystal or the internal
> > oscillator. The problem is the internal oscillator stability, not the
> > particular value of the oscillator.
>
> vasile
>
>   I am not using the hardware UART.  The k107 backpack is a serial
> interface to a LCD.  It uses 1 pin to communucate to the LCD and,
> in the version I have, only at 9600 Baud.  I am using the
> serial_software lib and with a 20MHz clock it works very well.
>
>   My goal was to get an LCD working on 8 pin chips, like the 12f509.  I
> 'thought' that I could use the internal 4MHz clock to generate the 9600
> Baud clock.  I must have mis-read or understood incorrectly.



Ok, understand now. You are using the serial software library.  You can use
the internal 4MHz clock, but almost sure you have to adjust the OSCCAL
register for a valid communication. I've did it on a few modules (less than
20) with PIC16F676 at 115200 and gave up when realised that every chip need
modifications of the OSCAL value. Since then I'm using crystals every time I
need communication without headaches.

As I've seen (never used) the serial_software library is optimised for
20MHz, however it uses the compiler build in delay, so it must work at 4MHz
too.



>
> > However I've seen at least twice a situation when the usart common.jal
> does
> > not compute correct the spbrg value, without being able to catch the
> > problem. So the question for other guys is how they debug such kind of
> > errors as long there isn't a valid communication for terminal debugging?
> >
> > I didn't figure a usefull way of using "pragma error". Old jal had
> "pragma
> > test assert " which was a damn good feature. How do you use the "pragma
> > error" for debugging?
>
>   I have seen that in some of the libs also but have not found anything
> else about how to use it.  I probably missed it or, more likely, didn't
> understand it.  :-(


Forget it at this moment.

Thanks for the reply!
>
> Regards
> Wayne
>
>
>
> > Vasile
> >
> >
> > On 11/13/09, Wayne <[email protected]> wrote:
> >>
> >> Hi guys
> >>
> >> Finally made some progress on the k107 backpack.  Thanks to a comment
> >> made by Rob, I tried a 20 Mhz resonator on the 16f628a and it finally
> >> displayed the 'correct' characters on the LCD.  The same program did NOT
> >> work using 10,8 and 4 MHz resonators or with the 4MHz internal clock. It
> >> seems that the 20Mhz clock gets the 9600 baud rate correct while none of
> >> the others did.  Has anyone else had problems getting the 9600 Baud Rate
> >> working?  I am using the 'l' version of the compiler (compiled Aug 7
> 2009).
> >>
> >> I had hoped to use the k107 on a 12f509 using the internal clock but
> >> that does not seem to be possible now.
> >>
> >> Wayne
> >>
> >
> > >
> >
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to