PDA

View Full Version : Ra4/tock



mychangl
- 16th May 2007, 15:47
Correct me if i am wrong.
PIC16F84 - RA4/TOCK has dual function as I/O port and as clock input to TMR0.
To make it as input; OPTION_REG=OPTION_REG OR %0010000
( set bit 5 as advise in datasheet )

skimask
- 16th May 2007, 16:31
Correct me if i am wrong.
PIC16F84 - RA4/TOCK has dual function as I/O port and as clock input to TMR0.
To make it as input; OPTION_REG=OPTION_REG OR %0010000
( set bit 5 as advise in datasheet )

If you're using a PIC16F84, then
http://ww1.microchip.com/downloads/en/DeviceDoc/30430c.pdf

If you're actually using a PIC16F84A, then
http://ww1.microchip.com/downloads/en/DeviceDoc/35007b.pdf

sougata
- 16th May 2007, 17:15
Hi,

You are right. Setting bit5 high in the option registers configures your timer to accept external clock to count. You also need to set the TRISA bit 4 to 1 accordingly to set as input.

It has a schmitt trigger input which takes much of the pain interfacing it to real world.

While using it as output please note that it is open drain. So you get low levels and floating. Use a pull-up for logic outputs.

I have never used a 16F84 and really did not care about the differences of the A version. But Microchip does maintain a backward compatibility. Bits unused or reserved in one family may have functions in the upper one.

It would be helpful to know what is your application to share knowledge.

BTW skimask he did mention about the datasheet. Not everybody is smart enough to comprehend the manual (take me for example :D). Also there are members of this forum whose native language is not English. Wouldn't it be nice for pro-s like you to actually teach and share knowledge than to give lame pointers. It increases your post count however, if that is a hobby.

skimask
- 16th May 2007, 17:29
BTW skimask he did mention about the datasheet. Not everybody is smart enough to comprehend the manual (take me for example :D). Also there are members of this forum whose native language is not English. Wouldn't it be nice for pro-s like you to actually teach and share knowledge than to give lame pointers. It increases your post count however, if that is a hobby.

Post count - shmost count...who cares...
Looks to me like post #1 has a very good grasp of the english language, as well as PIC 'jargon' and registers and the functions contained therein.
The sheet says exactly what's needed to know, right there, black and white, page 9.
These so called 'lame pointers' will save a LOAD of time in the future...learn to fish...

EDIT: but now that you mention the post count...WOW...that's a lot of typing...

T.Jackson
- 16th May 2007, 17:46
Sougata, I think that was totally uncalled for. Skimask provided the user with 2 direct references.

skimask
- 16th May 2007, 17:52
Sougata, I think that was totally uncalled for.

I don't know if it was totally uncalled for...
after all, now I've got a new hobby... :D

sougata
- 17th May 2007, 05:39
Hi,

The query of the post seems to be like asking for a confirmation by mychangl. He mentioned the datasheet. That does mean he is having the datasheet and gone through it.


To make it as input; OPTION_REG=OPTION_REG OR %0010000
( set bit 5 as advise in datasheet )


Do you still think T.Jackson that two datasheet direct references are all what he wants.

So if that was totally uncalled for then I appologise to skimask and all the forum members and promise to provide similar direct references. I receive microchip technical library cd-rom which is almost like a rip of their site. So got a lot of references to app-notes and datasheet.

Its not about letting skimask down or offending him. Skimask is not a novice. So expectations are higher. This forum has helped me a lot in learning PIC by active support, code snippets, suggestions, warnings, and so on from the forum members. Datasheets can always be found on the microchip website and now it even offers an offline selection tool. Microchip has a 24/7 email support system. A much bigger forum with members from the Microchip FAE and product development managers too.

I hope this forum is different with members like MisterE, DT, Melanie to name a few who seldom asks for something themselve but put in time and effort to solve other's problem.

I hope I have made my intentions clear.

T.Jackson
- 17th May 2007, 07:22
Well, giving someone a reference to a data sheet is sometimes a lot more help than a lot of other people are willing to give. I don't see any negative intentions in his current posts.

Melanie
- 17th May 2007, 08:51
Correct me if i am wrong.
PIC16F84 - RA4/TOCK has dual function as I/O port and as clock input to TMR0.
To make it as input; OPTION_REG=OPTION_REG OR %0010000
( set bit 5 as advise in datasheet )

Stop faffing about (another new word Adam?) and give a straight answer if you're going to give one...

This post has a little ambiguity, if you want to make RA4 a DIGITAL INPUT then all you need to do is set the TRISA Register accordingly...

TRISA.4=1

If you need to use this as a CLOCK INPUT to TMR0 then you need to do a little more...

TRISA.4=1
OPTION_REG.5=1

By setting the INDIVIDUAL BIT in the Register, you leave all the other bits alone. This saves a little worry as to whether you're setting other things correctly or not. Otherwise you run the risk of setting or resetting something you've not paid attention to, which could impact on your program unnescessarilly.

You may also need to set to set Bit 4 of OPTION_REG depending if you want High-to-Low pulse transition to trigger the clock rather than Low-to-High. See Figure 4-1 of the Datasheet (DS30430C Page 16 in case your Datasheet isn't the same as mine) for detail on the OPTION_REG settings.

Done, dusted and saves on wasted bandwidth.

Ioannis
- 17th May 2007, 09:32
....
Done, dusted....

Goodwifes!

(I have some dust here too... :-) )

Melanie
- 17th May 2007, 17:15
Goodwifes! - plural - you mean you have more than one?

I have some dust here too... :-) - for a small fee I'll loan you my housekeeper...

Ioannis
- 18th May 2007, 06:56
Goodwifes! - plural - you mean you have more than one?

As of 21st of October 2006, yes!
http://www.picbasic.co.uk/forum/showthread.php?t=4889

She 's not dusting yet but hope in a couple of years...

Ioannis