Close

Finally UDF!!

A project log for Access B

Create applications in Visual Studio C# that can communicate with a 18F2550 and use it's peripherals

omarOmar 10/28/2015 at 05:222 Comments

Finally I implemented UDF in C# class files (AccessB_class.c, AccessB_winusbapi.cs) and the MPLAB X project, now if you want to make your own custom function to be included in AccessB you must open the MPLAB X project and write the code inside the UDF function on the UDF.c file and compile the entire project, then use UDF programmer to open the hex file and click program, it will extract ONLY the UDF opcodes and then it will program all the program data on the 18F2550, you can after call the UDF using the CALL_UDF method.

UDF support ISR but low priority only, this because high priority interrupts are used by USB module, setting another high priority interrupt source may cause unexpected behaivor on the USB module.

Another update on the C# class files are the GPIO methods GPIOx, GPIO_DIRx, GPIO_LATCHx give access to PORTx, TRISx, and LATCHx SFR but in a more general way, more experienced PIC uses may prefer to use the TRIS/PORT/LATCH (that is a more direct and fast way to access I/O) and lees experienced PIC users may prefer to use GPIO, well I don't want to enter in to details now so I will make an user guide :)

The next stage is to design a new PCB, this will include voltage level shifting from 5v to 3.3V / 2.5V / 1.8V / 1.2V in five I/O corresponding to SPI/I2C/USART, and all will be SMD in a double layer PCB.

All the projects now include the update versions of the C# files, also I included the link to the GitHub repo of the UDF programmer.

Discussions

Jarrett wrote 10/28/2015 at 14:47 point

Every new project log you've added includes another voltage rail :)

Are you going to be adding a whole lot of power supplies?

The method I'd choose would be a PIC-controlled buck regulator feeding a wide-operating-voltage buffer.

Similar to how Microchip used a boost converter circuit in their PicKit 2, but you know, to generate a high voltage programming rail instead of a lower voltage.

  Are you sure? yes | no

Omar wrote 10/30/2015 at 20:21 point

Hi Jarrett.

I won't lie to you, my first idea was add four voltage regulator one for every voltage level with 150-300 mA each one in SOT-23/TSOT-5 format and the voltage level shifting circuit made with five BSS138 mosfets, then the user will select which voltage want to be applied to the mosfets with jumpers...
Your idea sounds great I don't know why I don't thought that before, I will invetigate and compare costs.
Thanks!

  Are you sure? yes | no