It is currently 22 Apr 2018 13:43

All times are UTC + 1 hour




Post new topic Reply to topic  [ 22 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: PIC18F45K22 EUSART
PostPosted: 06 Sep 2017 06:17 
Offline

Joined: 04 May 2012 10:52
Posts: 34
Location: Canada
Hi Darko and all,

Thanks again! Can you guys provide an example how to receive an array of bytes with undefined length (dynamic array)? I have some application where quantity of receiving bytes in a sequence might be from 2 to 100.

Vlad


Top
 Profile  
 
 Post subject: Re: PIC18F45K22 EUSART
PostPosted: 07 Sep 2017 22:41 
Offline
User avatar

Joined: 21 Mar 2017 16:57
Posts: 527
Hi,

It is always a good idea to reserve memory for your variables, in my opinion. If in doubt - better reserve as much as you think the longest one will be.
You can use pointers to addresses and simply increase the pointer each time you get an interrupt. That way you'd be able to write down arrays with unknown length. This is dangerous as you can 'wonder' in the area with the code - so this method requires good coding skills with the pointers, and it's never safe - since the array could just go on. If you know array's limit - then you can simply reserve that much and not worry if it's only 25 members or 250 members long...

Best regards


Top
 Profile  
 
 Post subject: Re: PIC18F45K22 EUSART
PostPosted: 04 Jan 2018 07:21 
Offline

Joined: 04 May 2012 10:52
Posts: 34
Location: Canada
Hi Darko and all,

Is there any code example how to implement the handshaking (CTS line) to the UART library?

Thanks!


Top
 Profile  
 
 Post subject: Re: PIC18F45K22 EUSART
PostPosted: 04 Jan 2018 18:03 
Offline
mikroElektronika team
User avatar

Joined: 15 Jan 2016 12:50
Posts: 1717
Hi,

You may find these links useful:

viewtopic.php?p=94816

https://www.mikroe.com/blog/uart-serial-communication

Kind regards,
Lana


Top
 Profile  
 
 Post subject: Re: PIC18F45K22 EUSART
PostPosted: 04 Jan 2018 18:14 
Offline

Joined: 04 May 2012 10:52
Posts: 34
Location: Canada
Lana,

Thank you!

I have some control software provided by others which waits for the CTS signal from the device (DCE) based on the PIC18F45K22 so I need to generate the CTS.
I use the LATC.4 port for that and it does operate the CTS line but I am not able to handle the CTS in the particular place of the Rx/Tx sequence in terms of timing. It seems I have to use some UART library function return properly, I could be wrong.
As an USB to UART converter I use CH340G converter with RTS/CTS handshaking lines provided.

I would be appreciated for some piece of code guys.


Top
 Profile  
 
 Post subject: Re: PIC18F45K22 EUSART
PostPosted: 05 Jan 2018 16:47 
Offline
mikroElektronika team
User avatar

Joined: 15 Jan 2016 12:50
Posts: 1717
Hi,

Unfortunately, we don't have example for CTS handshaking and PIC18F45K22,
and we don't have CH340G so I cannot test it.

Kind regards,
Lana


Top
 Profile  
 
 Post subject: Re: PIC18F45K22 EUSART
PostPosted: 05 Jan 2018 17:39 
Offline

Joined: 04 May 2012 10:52
Posts: 34
Location: Canada
A link to the article about handshaking implementation with Atmega644 micro: http://simmonmt.blogspot.ca/2011/05/rts ... forms.html


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 22 posts ]  Go to page Previous  1, 2

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: