Full playlist on the PIC microcontroller Programming kzbin.info/www/bejne/gYSsZ5mwhLWJsJI If there is anything you would like to see let me know.
@vantoanle82573 жыл бұрын
as I know, Input TRIS.. =1, output TRIS... = 0. TRISCbits.RC6 and RC7 are TX and RX. RC6 is transferred, RC7 receives mean RC6 output and RC7 input. Why you use both of them for input " RC6 RC7 = 1 "
@BinderTronics3 жыл бұрын
@@vantoanle8257 0:40
@vantoanle82573 жыл бұрын
@@BinderTronics thank you so much, i dont see that.But when reading PIC16F887 datasheet, I realized it doesn't have that line, so with pic16f887 I also configure it like you?
@BinderTronics3 жыл бұрын
@@vantoanle8257 12.1.1.1 Note 1. No need to alter the TRIS register.
@alexapetri72004 жыл бұрын
On a PIC18F45k22 I also had to set ANSELCbits.ANSC7 = 0 and ANSELCbits.ANSC6 = 0 . And be careful at the register names because you have two UARTS (TXSTA1 or TXSTA2, for example). In case someone needs this, ofc, not Binder Tronics. Thank you, it's working!
@tomasparrado8734 жыл бұрын
I have a suggestion/request: Uart communication with the CRC peripheral. I'm using a PIC18F26Q10 to control stepper motors through TMC2209 where the more advanced features can be accessed through serial communication with CRC. Its not the only chip (tends to be high power/noisy chips) that wants or has this additional check. They have an example in the datasheet using code, but a lot of the PIC18F have CRC hardware built in. Ben Eater did a fantastic tutorial on how CRC works ("How do CRCs work?") but an example 'irl' would be awesome (for me at least). Great tutorial set, more on any peripheral would be great. How about USB or the new ADC2? Subscribed
@BinderTronics4 жыл бұрын
If noise is a issue use a RS232 to RS422 connection and keep the RS232 lines a short as possible. This eliminates 99% of the noise problem but this not always piratical. The industry approach to CRC is get someones open souce library for what ever protocol you are working with since most of it is standardized or someone in the company has already written one. I will have a look into it though. I am currently working on a CDC USB device video but I have no idea how long it will take. I will put ADC2 on the list. I am prioritizing getting SPI out the door at the moment.
@tomasparrado8734 жыл бұрын
@@BinderTronics Good suggestion to eliminate noise. In my case the hardware I'm using doesn't give you another choice except uart with CRC bits. Ordinarily I'd be happy to get a C library, and do it in firmware but it seems a shame when it's a built in peripheral. I'll give the MPLAB Code Configurator a go and hopefully pick it apart. A USB serial is a great idea as is SPI, I think a lot more people will find it useful. Capacitive touch / mTouch / touch buttons might be another video with wider appeal (and fairly easy too).
@erictutkowski8494 жыл бұрын
Really great channel! I've been giving your videos a watch and they help out so much. I'm trying to get UART working but I need some sort of display or terminal for it to send the transmission to and I'm not sure how to do that :/. Got any tips for setting up putty with it?
@BinderTronics4 жыл бұрын
Going to assume you got a CH340 or FTDI usb-to-serial board. Don't get a prolific based one... piece of crap. Otherwise follow this guide pbxbook.com/voip/sputty.html there are linux and mac guides there as well.
@erictutkowski8494 жыл бұрын
@@BinderTronics not sure if I'm using what you stated above, But as for the chip it's a bit more complex I believe. I've been using a p32mx795f512l and while the ports are different from yours in many ways, your videos have been a great reference to use alongside the manual. I'll definitely check out the link for setting up putty though, thanks so much!
@erictutkowski8494 жыл бұрын
@@BinderTronics Ok! I think I have the terminal working correctly now. Just have to fix up my code and make it run :)
@erictutkowski8494 жыл бұрын
@@BinderTronics Finally got code working! For some reason my Serial to USB drivers weren't installed, which caused the brunt of my issues. Thanks a million for the putty set up though :)
@stewartmclaughlin11994 жыл бұрын
Mooi so! Weet jy hoe om groter datatipes soos float oor die lyne te stuur?
@BinderTronics4 жыл бұрын
Het 'n stuck kode wat dit doen in die video kzbin.info/www/bejne/r3fZe4uulr5nhZI
@stewartmclaughlin11994 жыл бұрын
@@BinderTronics Wonderlik, baie dankie!
@adrianV686 жыл бұрын
Would it change the procedure a lot if we wanted to establish communication with a bluetooth module?
@BinderTronics6 жыл бұрын
No, just need to change the baud to match the module and create a fifo buffer for the received data. Also may need to create some form of AT parser. You will probably run into lack memory on the 18f4520 before anything else. If you are using another PIC I would suggest using Microchip Code Configurator plug-in to setup the UART.
@adrianV686 жыл бұрын
Thanks
@gokulg95414 жыл бұрын
How will you receive from the UART2? RCREG2?! . Why did you use the RCREG instead of RCREG1 for UART1?
@BinderTronics4 жыл бұрын
Going to assume your PIC microcontroller has 2 or more UART module on it. I use RCREG cause that is the naming of the C structure for that register on the PIC microcontroller I am using. Since there is only one UART on the PIC it does not need the number at the end of the naming. In the case where there is more than one module that have the same register structure (doing the same thing) the naming will be registerX (UARTx). So if you are working with UART1. All register associated with UART1 will be followed by a 1 thus the RCREG1 in your case.
@AlbertRei34243 жыл бұрын
How did you connect the PIC to the PC ? ¨Pickit3 ? It supports UART?
@BinderTronics3 жыл бұрын
Watch the Schematic section again. I use a FTDI usb to serial.
@jasmenelee2 жыл бұрын
Can u please make video on PIC18F27K42 on UART asynchronous receiver?
@BinderTronics2 жыл бұрын
What is unclear in the datasheet?
@meherkhan74564 жыл бұрын
hello, I'm quite new to micro controller. I cant understand the start bit and the end bit of a signal. Could you please make it a bit clear. love your videos & thanks in advance.
@BinderTronics4 жыл бұрын
Frame format: Idle | start | data | parity | stop idle: digital high start : 1 bit width low data: 5-9 data bits. parity: 1 or 0 of 1 bit width stop : 1 or 2 high bit widths 1 bit width is the baud rate. Since this is a Asynchronous hardware protocol, each bit has a set time it can be high or low. This also means that the sending and receiving end needs to be configured identical for it to work. So a start bit is 1 bit width low. The stop bits are 1 or 2 bit widths at the end of a frame. In most cases for UART you don't need to concern yourself with the how the frame is generated. All you need to do is load the transmit register (TXREG in this case) and the frame is generated for you. All you need to concern yourself with is the data width, parity type, number of stop bits and the baud rate in the setup. ww1.microchip.com/downloads/en/DeviceDoc/Atmel-7810-Automotive-Microcontrollers-ATmega328P_Datasheet.pdf 19.4 Frame Formats
@meherkhan74564 жыл бұрын
Thanks a lot
@nitinkamble63995 жыл бұрын
hi sir, i want lora ra-02 module interface with pic microcontroller, so please help
@BinderTronics5 жыл бұрын
Only familiar with Lora RF1276-868RS232 witch is just straight RS232 interface. Have not touched the ra-02 modules.
@gokulg95414 жыл бұрын
Well explained!
@prasanthchigurupatii2 жыл бұрын
Loved
@diyelectronics31585 жыл бұрын
Header file error occurs usually. .why
@BinderTronics5 жыл бұрын
#include for newer compilers. Otherwise going to need more context.
@diyelectronics31585 жыл бұрын
@@BinderTronics how can I add header files as we do in arduino. ..any link. .??
@BinderTronics5 жыл бұрын
@@diyelectronics3158 Project Tree > right click > Add Existing Item kzbin.info/www/bejne/hYKZmY2woNuLg9k same place as adding new files
@Tortuga23214 жыл бұрын
SPBRGH = (gen_reg & 0xFF00) >> 8; SPBRG = gen_reg & 0x00FF; teacher why did you do this ?I did not understand. Is to ignore high byte
@BinderTronics4 жыл бұрын
SPBRGH and SPBRG are both 8 bits wide registers. gen_reg is 16 bits wide. SPBRGH is equal to the upper 8 bits of gen_reg. SPBRG is equal to the lower 8 bits of gen_reg. kzbin.info/www/bejne/oJqnhpycl912bLc
@Tortuga23214 жыл бұрын
@@BinderTronics thank you so much. So my teacher, what do TXREG and RXREG do?
@BinderTronics4 жыл бұрын
TXREG = data to send. RXREG = data received. datasheet section 18.2.1 and 18.2.2
@pengpleb5 жыл бұрын
Thank you so much, finally got this damn UART to work. However, I had to do some changes under MPLAB X IDE v5.30 and XC8 v2.10: - #include - void __interrupt() high_isr(void); - void __interrupt(low_priority) low_isr(void); (Same signature when implementing the interrupts at the end of the file).
@BinderTronics5 жыл бұрын
Thanx for the update. Probably too get the compiler stander with other multi interrupt PICs. Added a comment on Tutorial #5 - Interrupts ( kzbin.info/www/bejne/g5qzqYmjn8Shfqs ) if you want to claim credit.
@AlbertRei34243 жыл бұрын
@@BinderTronics I think it is no longer necessary to include : #include
@BinderTronics3 жыл бұрын
@paul The header is there for reference. The compiler will drop is if it is included somewhere else.
@AlbertRei34243 жыл бұрын
@@BinderTronics I have never included the header and I have no issue for now
@shite96782 жыл бұрын
I keep getting error conflicting data types for uart_send... any idea?
Thanks for the response, I've got it all worked out now. Using the PIC18F45K22 like stated in comments below I have multiple registers ex. "TXSTA1" and I'm on C99 which has some syntax differences ex. Interrupts. I'm controlling basic GPIO functions through UART atm and now working on reading i2c Honeywell temp and humidity sensor. Thanks for all you do bud and look forward to more videos.