BasicMicroUK - Forums

www.basicmicro.co.uk
It is currently Tue Jan 23, 2018 8:33 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: HARDWARE SERIAL CONTROL
PostPosted: Fri May 30, 2014 8:35 pm 
Offline
Citizen

Joined: Thu Feb 06, 2014 7:37 pm
Posts: 19
HELLO;I am using the nano 28,I have the hserial enabled.Every thing is fine with that,the problem I have,and my question is, how can I disable the hserial device(turn off) say if a switch is on...and then enable if the switch off ??? Something about turning of the bit associated with that register. THANKS FOR ANY HELP...


Top
 Profile  
 
 Post subject: Re: HARDWARE SERIAL CONTROL
PostPosted: Mon Jun 02, 2014 4:05 am 
Offline
Master

Joined: Wed Oct 19, 2011 2:28 am
Posts: 123
Hi,
I never used the hserial but I think you can do the following command to disable the serial port. At the end of the manual there are some reserved word that can be use to go directly to access the registers use in the nano chip.

''RCSTA = RECEIVE STATUS AND CONTROL REGISTER :: bit 7 = SPEN : bit 7 = 1 --Serial port enabled : bit 7 = 0 ' Serial port disable


RCSTA = 0 'instruction to zero the register bit 7 to disable the serial port.

Try it to see if it work. Good luck

Regards,
Tauro0221


Top
 Profile  
 
 Post subject: Re: HARDWARE SERIAL CONTROL
PostPosted: Mon Jun 02, 2014 4:18 pm 
Offline
Citizen

Joined: Thu Feb 06, 2014 7:37 pm
Posts: 19
HI TAURO 0221;
i tried this;
RCSTA.BIT7 = 0
did not seem to work..something else i need to put??? the hserial port was still active...
thanks..


Top
 Profile  
 
 Post subject: Re: HARDWARE SERIAL CONTROL
PostPosted: Mon Jun 02, 2014 5:28 pm 
Offline
Master

Joined: Wed Oct 19, 2011 2:28 am
Posts: 123
Hi,
Then try both instructions. This will turn off the TX and RX.

TXSTA=2 : RCSTA = 0


You can find this information in the help/PIC16F882/883/884/886/887 Data Sheet page 254


Good luck.


Top
 Profile  
 
 Post subject: Re: HARDWARE SERIAL CONTROL
PostPosted: Mon Jun 02, 2014 6:25 pm 
Offline
Citizen

Joined: Thu Feb 06, 2014 7:37 pm
Posts: 19
HI;
This is how i typed in the code:

RCSTA.BIT7 = 0
TXSTA.BIT5 = 0

still the hserial device is active,and that keeps the ftdi chip thinking there is data rx/tx..
any other ideas???? thanks...


Top
 Profile  
 
 Post subject: Re: HARDWARE SERIAL CONTROL
PostPosted: Mon Jun 02, 2014 6:43 pm 
Offline
Master

Joined: Wed Oct 19, 2011 2:28 am
Posts: 123
Hi,
I think TX need to be = 2. Do it like this:
TXSTA = 2 : RCSTA = 0
You will zero all other bits too. By doing one bit you left the other bits unchanged.

Regards,
tauro0221


Top
 Profile  
 
 Post subject: Re: HARDWARE SERIAL CONTROL
PostPosted: Mon Jun 02, 2014 8:02 pm 
Offline
Citizen

Joined: Thu Feb 06, 2014 7:37 pm
Posts: 19
HI:
Well i try it and still not work...
if i use:
ENABLEHSERIAL
SETHSERIAL1 H9600

device is enabled...reset micro will disable device...
maybe someway to do a code type of reset???
any ideas will help....thanks...


Top
 Profile  
 
 Post subject: Re: HARDWARE SERIAL CONTROL
PostPosted: Mon Jun 02, 2014 9:33 pm 
Offline
Master

Joined: Wed Oct 19, 2011 2:28 am
Posts: 123
Hi,
This is what the manual explained how you turn on the tx/rx. By zeroing RCSTA and TXSTA you should stop the uart.

12.1.2.1 Enabling the Receiver
The EUSART receiver is enabled for asynchronous
operation by configuring the following three control bits:
• CREN = 1
• SYNC = 0
• SPEN = 1

12.1.1.1 Enabling the Transmitter
The EUSART transmitter is enabled for asynchronous
operations by configuring the following three control
bits:
• TXEN = 1
• SYNC = 0
• SPEN = 1

Do the following test read the RCSTA register and the TXSTA as soon you initialized the micro and them after you start the uart.
This will tell us how the status register it is set before and after .

dim tmp_1 as byte
dim tmp_2 as byte

tmp_1 = TXSTA
serout s_out ,i9600 ,[" TXSTA = ",dec tmp_1, 13 ]
tmp_2 = RCSTA
serout s_out ,i9600 ,[" RCSTA = ",dec tmp_2, 13 ]

Also you can try do something like this :
TXEN = 0 : SYNC = 0 : SPEN = 0
CREN = 0 : SYNC = 0 : SPEN = 0



Regards.
tauro0221


Top
 Profile  
 
 Post subject: Re: HARDWARE SERIAL CONTROL
PostPosted: Mon Jun 02, 2014 11:33 pm 
Offline
Master

Joined: Wed Oct 19, 2011 2:28 am
Posts: 123
Hi,
Try one more thing. Do setserial1 0


Regards,
tauro0221


Top
 Profile  
 
 Post subject: Re: HARDWARE SERIAL CONTROL
PostPosted: Tue Jun 03, 2014 3:51 pm 
Offline
Citizen

Joined: Thu Feb 06, 2014 7:37 pm
Posts: 19
HELLO;
Thanks for the last post...that one solved the problem.
SETHSERIAL1 0
that command works great!!!
the uart now turns on and off as commanded.
Thank you for your time....


Top
 Profile  
 
 Post subject: Re: HARDWARE SERIAL CONTROL
PostPosted: Tue Jun 03, 2014 4:46 pm 
Offline
Master

Joined: Wed Oct 19, 2011 2:28 am
Posts: 123
Hi,
Your welcome.
There are some instructions in the manual that they tell you how to use and enable them but they forgot to tell you how to turn it off.

Regards,
Tauro0221


Top
 Profile  
 
 Post subject: Re: HARDWARE SERIAL CONTROL
PostPosted: Tue Jul 01, 2014 6:18 pm 
Offline
Citizen

Joined: Thu Feb 06, 2014 7:37 pm
Posts: 19
THANK YOU


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


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

Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO