USART
Moderators: David Barker, Jerry Messina
USART
Hello everyone,
Is is possible to use both software and hardware USART together on the same pic? I am using a 18F1220 and need to talk to a SGLCD and the PC. I want to use software USART for the SGLCD and the Hardware USART for the pc. Thanks.
Is is possible to use both software and hardware USART together on the same pic? I am using a 18F1220 and need to talk to a SGLCD and the PC. I want to use software USART for the SGLCD and the Hardware USART for the pc. Thanks.
Running version 2.2.4.0 ICC 1.2.1.0
Regards CharlieM
Regards CharlieM
- David Barker
- Swordfish Developer
- Posts: 1214
- Joined: Tue Oct 03, 2006 7:01 pm
- Location: Saltburn by the Sea, UK
- Contact:
-
- Registered User
- Posts: 185
- Joined: Mon Mar 10, 2008 8:20 am
- Location: Seattle, WA USA
- Contact:
The software UART works well for transmitting data. Not so wll for receiving it in my experience.
I did have a moment of clarity a short while back regarding the software UART. If you're using the PICkit 2 to program, and then swapping connections to the UART pins just to monitor program parameters, use the software UART with PortB.7 to transmit. Program the PIC, then switch over to the UART tool without changing connections, Works brilliantly.
Jon
I did have a moment of clarity a short while back regarding the software UART. If you're using the PICkit 2 to program, and then swapping connections to the UART pins just to monitor program parameters, use the software UART with PortB.7 to transmit. Program the PIC, then switch over to the UART tool without changing connections, Works brilliantly.
Jon
- David Barker
- Swordfish Developer
- Posts: 1214
- Joined: Tue Oct 03, 2006 7:01 pm
- Location: Saltburn by the Sea, UK
- Contact:
Open the module and search for the module identifier. For SUART.bas it is listed as:
Which means you can now use the UART identifier with dot notation to access any publicly visible objects, for example: UART.Write("Hello World")
In the case of USART.bas, it is listed as
Which as you have found out is used like so: USART.Write("Hello World")
Code: Select all
Module UART
In the case of USART.bas, it is listed as
Code: Select all
Module USART
digital-diy.com - Hobby microcontroller projects and tutorials. Assembly, PICBasic and C examples.
Australian distributor for the Swordfish Compiler
Australian distributor for the Swordfish Compiler
Thanks,
I must be dense this morning. When using the hardware USART and the Software USART together, both use Usart.write to send a byte to the usart buffer. If I have both the software usart and the hardware usart initialized what usart is going to be used? I have to include both "USART.bas and "SUSART.bas".There is nothing that says write to hardware buffer or write to software buffer? So I guess I can't use them together.[/b]
Thanks for the help.
I must be dense this morning. When using the hardware USART and the Software USART together, both use Usart.write to send a byte to the usart buffer. If I have both the software usart and the hardware usart initialized what usart is going to be used? I have to include both "USART.bas and "SUSART.bas".There is nothing that says write to hardware buffer or write to software buffer? So I guess I can't use them together.[/b]
Thanks for the help.
Running version 2.2.4.0 ICC 1.2.1.0
Regards CharlieM
Regards CharlieM
- David Barker
- Swordfish Developer
- Posts: 1214
- Joined: Tue Oct 03, 2006 7:01 pm
- Location: Saltburn by the Sea, UK
- Contact:
You can use them together. See online help or press F1 after typing 'write'. For example,
if you cannot work that way, alias the names. For example,
Code: Select all
USART.Write("boo",13,10) // write to hardware
UART.Write("boo",13,10) // write to software
Code: Select all
Dim HW_Write As USART.Write,
SW_Write As UART.Write