PIC receive/transmit data

Discussion about projects that used PIC Microcontroller, Hardware Interface, Programming Algorithm and etc......

Re: PIC receive/transmit data

Postby robosang » Fri Oct 22, 2010 7:57 pm

nicholaswsw WROTE:I'm a newbie here... I just want to ask 16F877a it's a 8 bit microcontroller, and Zigbee uses 16 bit addressing. Can I connect the two of them together?


8-bit microcontroller means the CPU can process 8-bit data an instruction. 16-bit addressing is just the address size you can set for it. Both are totally 2 different category.
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm

Re: PIC receive/transmit data

Postby nicholaswsw » Mon Feb 28, 2011 7:32 pm

ermm i have a problem more like a question my barcode scanner which i want to connect to my PIC16F877A using UART.
the barcode scanner only comes with USB cable, can i use UC00A to convert from USB to UART??

if no are there any solution around this?? as in how do i convert from USB to serial without going through a PC?
nicholaswsw
Newbie
 
Posts: 12
Joined: Tue Sep 21, 2010 1:46 am

Re: PIC receive/transmit data

Postby kl84 » Tue Mar 01, 2011 10:49 am

nicholaswsw WROTE:the barcode scanner only comes with USB cable, can i use UC00A to convert from USB to UART??

Nope, you can't. Barcode scanner is USB device. It needs to be connected to USB host.

nicholaswsw WROTE:if no are there any solution around this?? as in how do i convert from USB to serial without going through a PC?

You need a barcode scanner which connection is uart...this is the easiest way. Otherwise, I'm not sure a microcontroller featuring USB host capability may be used to interface..:?:
User avatar
kl84
Amateur
 
Posts: 166
Joined: Thu Jul 08, 2010 12:14 pm

Re: PIC receive/transmit data

Postby ober » Wed Mar 02, 2011 10:31 am

nicholaswsw WROTE:ermm i have a problem more like a question my barcode scanner which i want to connect to my PIC16F877A using UART.
the barcode scanner only comes with USB cable, can i use UC00A to convert from USB to UART??

if no are there any solution around this?? as in how do i convert from USB to serial without going through a PC?


No, like kl84 stated, Since your barcode scanner is USB, you will need to connect it to USB host and the ready and easiest to get USB host is computer. If you observe carefully, you will notice that USB device cannot connect with USB device, they are being block in-term of hardware connection. Try this, connect USB mouse and USB keyboard, it cannot be done, why? Because both these device have the same USB connector which prevent them to interconnect. :mrgreen:

Yes, there is microcontroller with USB host capability, but still you will need the driver on it. Microchip do provide several type of microcontroller with USB host or USB OTG, and USB driver too, but I have yet to see bar code scanner in the list.
Ober Choo
Cytron Technologies Sdn Bhd
www.cytron.com.my
User avatar
ober
Moderator
 
Posts: 1486
Joined: Wed Apr 15, 2009 1:03 pm

Re: PIC receive/transmit data

Postby nicholaswsw » Sat Mar 26, 2011 11:19 pm

i have another question can you use PIC to change the address of SKXBee
like say i send '+++' to enter command change the destination address of the ZigBee?
nicholaswsw
Newbie
 
Posts: 12
Joined: Tue Sep 21, 2010 1:46 am

Re: PIC receive/transmit data

Postby nicholaswsw » Sat Mar 26, 2011 11:19 pm

i have another question can you use PIC to change the address of SKXBee??
because i can't seem to change using PIC connecting through UART, here's the source code.

putch ( '+' );
DelayMs ( 100 );
putch ( '+' );
DelayMs ( 100 );
putch ( '+' );
DelayMs ( 250 );
DelayMs (250);

printf ("atwr");
DelayMs (250);

printf ("atdl3333");
DelayMs (250);

printf ("atwr");
DelayMs (250);

printf ("atdl3333");
DelayMs (250);

printf ("atcn");
DelayMs (250);
nicholaswsw
Newbie
 
Posts: 12
Joined: Tue Sep 21, 2010 1:46 am

Re: PIC receive/transmit data

Postby ober » Sun Mar 27, 2011 1:59 pm

Not familiar with the putch and printf function. Is this function from MikroC or CCS? Anyway what is exactly, in ascii code the printf going to send? let's say printf("atdl333")? What will actually happen if I look at the transmit line of PIC? Can you test this program by connecting the PIC to computer and look at the output?
Ober Choo
Cytron Technologies Sdn Bhd
www.cytron.com.my
User avatar
ober
Moderator
 
Posts: 1486
Joined: Wed Apr 15, 2009 1:03 pm

Re: PIC receive/transmit data

Postby robosang » Sun Mar 27, 2011 6:48 pm

I think you need to have "enter" at the end of each string right? Even when we are using XCTU, you will need to "enter" for the XBee to accept the AT command, right?
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm

Re: PIC receive/transmit data

Postby nicholaswsw » Sun Mar 27, 2011 8:52 pm

printf ("atwr/r/n");
DelayMs (250);

you mean i have to do this?
and i use printf to send character 'C' last time when i was testing does that mean that PIC is sending ASCII ? i'm using microC
nicholaswsw
Newbie
 
Posts: 12
Joined: Tue Sep 21, 2010 1:46 am

Re: PIC receive/transmit data

Postby yonghui » Tue Mar 29, 2011 10:35 pm

hi,

CR, carriage return is needed --> 13 or 0x0D

PIC sending high and low signals, binary. the compiler with convert ascii character to appropriate ascii value.


regards,
yh
thanks&regards,
yh
yonghui
Professional
 
Posts: 732
Joined: Mon Sep 28, 2009 3:27 pm

PreviousNext

Return to PIC Microcontroller

Who is online

Users browsing this forum: No registered users and 8 guests

cron