Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Are XC32 libraries API different from C32 for PIC32 ?

Status
Not open for further replies.

2ndhandscope

Newbie level 4
Joined
Oct 15, 2012
Messages
7
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,326
Long story short, I was looking for a pdf of PIC32 peripheral libary for XC32 compiler because that was what I installed. Then I found out that Microchip didn't make pdf anymore, instead they put CHM files in the pic32-lib-help directory.
Ok, that's fine, but I notice the APIs are different from the C32 counterpart. If that is the case, then code written for C32 won't work on XC32 ??

Examples, from C32 - Uart

has some functions like :
Code:
BusyUART1
BusyUART2
CloseUART1
CloseUART2
etc...

But XC32 only has these:
Code:
Configuration
  Name  Description  
  UARTConfigure  UART module configuration routine.  
  UARTSetAddress  Routine to program the address for which the UART module may watch.  
  UARTSetFifoMode  Controls UART module TX and RX FIFO operation.  
  UARTSetDataRate  Routine to set the UART module's desired data data rate.  
  UARTSetLineControl  Routine to set the UART module's desired line control parameters.  

Control
  Name  Description  
  UARTEnable  Enables or disables the given UART module in the desired mode.  
  UARTWatchForAddress  Routine to enable or disable recognition of the programmed address byte.  
  UARTStartAutoDataRateDetect  Routine to automatically determine the data rate (bits-per-second) of an external transmitter to the UART.  
  UARTSendBreak  Routine to send a break signal from the UART.  

Data Transfer
  Name  Description  
  UARTGetData  Routine to get data received by the UART.  
  UARTSendData  Routine to send data through the UART.  
  UARTGetDataByte  Routine to get a byte of data received by the UART.  
  UARTSendDataByte  Routine to send a byte of data.  

Status
  Name  Description  
  UARTGetLineStatus  Provides current UART line status.  
  UARTReceivedDataIsAvailable  Routine to detect if the receiver has data available.  
  UARTTransmissionHasCompleted  Routine to detect if the UART module has finshed transmitting the most recent data.  
  UARTTransmitterIsReady  Routine to detect if the transmitter is ready to accept data to transmit.  
  UARTDataRateDetected  Routine to identify when automatic data rate detection has completed.  
  UARTGetDataRate  Routine to get the UART module's current data data rate.
 

Assuming you are using the plib, stuff there are two sets of functions (and have been for a while).
The newer ones take an argument to indicate which one of the serveral (for example) uarts you wish to control and the older ones where you have the device as part of the function name.

The newer ones relay on some fairly large static const data tables to map from device number to registers and bits, so if very memory constrained the older ones are better, but if you have plenty of flash then the newer ones make maintainance easier.

Regards, Dan.
 

Assuming you are using the plib, stuff there are two sets of functions (and have been for a while).
The newer ones take an argument to indicate which one of the serveral (for example) uarts you wish to control and the older ones where you have the device as part of the function name.

The newer ones relay on some fairly large static const data tables to map from device number to registers and bits, so if very memory constrained the older ones are better, but if you have plenty of flash then the newer ones make maintainance easier.

Regards, Dan.

You are right, in both C32 and XC32 , there exists 2 set of library headers, eg: UART.h and UART_legacy.h
So, to my previous question then,
No, compiler choices (C32 or XC32) don't matter and code will compile in both as they support the same APIs. :-D
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top