![]() ![]() ![]() I could display stuff while the code is running. I found the LCD to be an awesome debugging tool. I used an interrupt to just set a flag so the LCD does not update every time through the main loop. This allows the time critical stuff to have higher priority. The code for the LCD is in the main loop and not an interrupt. PSoC has a built in character LCD Component that makes using and LCD very easy. You could fine tune the filter right from your keyboard. If you would rather do this with an analog filter, you can design custom filters in the hardware. The firmware could invert the logic, but it is so much easier to read on the schematic. There are digital “nots” after the debouncers because my switches close to ground. The debouncers are all fed into a status register where they are read as a single value. It looks like this on the schematic.Īnother feature I used was hardware switch debouncing. The code sets it and the hardware clears it. You attach a clock and the clock determines the length of the pulse. PSoC control registers have a pulse feature that automates this. It works fine, but the code is messy and interrupts can cause timing issues. In normal hardware you have to raise the pin, then figure out a way to turn it off after a given period of time. ![]() Stepper drivers typically require a pulse of a minimum length to take a step. I used some special features to move functions out of code and onto the hardware. If (bit_isfalse(settings.flags,BITFLAG_INVERT_LIMIT_PINS)) Here is an example of the difference in firmware code. Have you ever swapped transmit and receive on a UART? In PSoC you can just swap the pins on the schematic. With PSoC you can do all of that in a visual schematic and pin wiring feature. ![]() It has to do a little logic gymnastics each time. That is great, but the code gets a little messy every time you access hardware. This is all done using #define values in configuration files. With a few limitations, you can move the pins around and change things like whether switches are active low or high. Grbl’s flexibility allows you to tailor it to your hardware. Here is a comparison between the the ATMega 328p (Arduino UNO) and the PSOC5 This has ARM Cortex M3 processor a lot of I/O and costs less than $10! It has a built in programmer and debugger. The dev board I used was the CY8CKIT-059. At the same time I wanted to take advantage of the features of the PSoC. I have always used them for small prototype projects, but wanted to test my skills by porting a major project like Grbl. There are over 200 ready to use components you can wire together on the chip. The digital blocks includes basic logic gates, all the way up to FPGA like components you program yourself in Verilog. The analog components are not basic ADCs and DACs, you have OpAmps, PGAs, filters, MUXs and more. You can configure them on the fly with many analog and digital components. I love working with the PSoC (Programmable System on Chip) family of micro controllers. He is always very helpful and this port would not have been possible without the quality of his code and his advice. It was originally targeted at the Arduino 328p hardware (UNO). It is used on a lot of small scale CNC machines and is the motion control code behind a lot of 3D printers. Grbl is a high performance CNC controller. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |