option 3 has to be done one day, but as you say: there probalby won't
be much demand.

For now, I choose option 4 ('non of the above" ;)
Add the aliasses to the library. if uart1 exists, it is mapped to
uart, unless const USE_UART2 = true. In this case... well you
understand.

Joep

2010/1/22 Rob Hamerling <[email protected]>:
>
> Hi guys,
>
> Today I wanted to do a test with an USART of the 18f6310. This PIC has 2
> USARTs and the names of the USART registers have suffixes 1 and 2.  That is
> not so surprisingly by itself, but it means that - even when you want to
> control only 1 USART - you cannot use the current serial libraries because
> these use register names without suffix.
>
> I've solved this by specifying some aliases in the program before including
> the serial library, as follows:
>
>> alias RCREG       is  RCREG1
>> alias RCSTA       is  RCSTA1
>> alias RCSTA_CREN  is  RCSTA1_CREN
>> alias RCSTA_FERR  is  RCSTA1_FERR
>> alias RCSTA_OERR  is  RCSTA1_OERR
>> alias RCSTA_SPEN  is  RCSTA1_SPEN
>> alias SPBRG       is  SPBRG1
>> alias TXREG       is  TXREG1
>> alias TXSTA       is  TXSTA1
>> alias TXSTA_BRGH  is  TXSTA1_BRGH
>> alias TXSTA_TXEN  is  TXSTA1_TXEN
>
> This is for the first USART. Of course when I wanted to use the second USART
> I would have used '2' in stead of '1' of course.
>
> I expect not many users would want to use 2 USARTs at the same time, and it
> would require a significant change of the serial libraries, or separate
> libraries. But at least we should allow the use of 1 USART for PICs with
> multiple USARTs. I see several possible solutions:
> 1. suggest in the docs to use the alias-technique as above
> 2. specify these aliases in the device files
> 3. provide another set of libraries (one for each USART)
>
> Item 1 is simple and flexible: a user can choose the USART
> Item 2 is convenient for the users, but can only be done for one specific
> USART (most likely the first)
> Item 3 is the most work for us
>
> Comments?
>
> Regards, Rob
>
>
> --
> Rob Hamerling, Vianen, NL (http://www.robh.nl/)
>
> --
> 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.
>
>

-- 
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