Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

reading ports...

Status
Not open for further replies.

me-electro

New Member
hi...

I am a new member...

I am doing a project using PIC16F877...

and it's my first time using microcontrollers...

I want to reed a value using this PIC and store it in a register inside...

BUT... I don't know how...

SO... can any one who know it help me...

thaks alot...

:oops:
 
You are going to need certain tools that are a must....
You need to have a compiler..... assember, basic, C.... for the langague you chose to use.
Then you are going to need a programmer like the EPIC..... so that you can download to the PIC the program you wrote

Depending on each program you read and store ports pins....

Good Luck

Ivancho
 
hi again..

thanx alot for answering me...

all the things you all said I have already...

BUT... I don't know how to write that program that will read the value and store it inside a register..... :shock: :?:
 
me-electro said:
hi again..

thanx alot for answering me...

all the things you all said I have already...

BUT... I don't know how to write that program that will read the value and store it inside a register..... :shock: :?:

You don't actually mention what sort of value it is you want to read, do you just mean reading a digital value from a port, or reading an analogue value. The first is extremely trivial, the simplest thing you could possibly do with a PIC - the second is pretty easy, but takes a few more lines.

However, even in the first case, you will need to perform various setup procedures on the chip, these will be a great deal longer than the reading itself.
 
For example in PICBASIC PRO all you do is define a variable and assign the port you want to read to that variable.... or simply read the register for the port.

DIM myVar as Byte

MyVAr = PortB ' Now myVar will have the value of RB7-RB0

To be able to read inputs you havve to set the "direction" register, which is TRISB for PortB. Then you can assign which pin are inputs and which are outputs.

What you need is a tutorial for the program you want to use...... PICBASIC is probably the easiest and quickest to learn.

Good Luck

Ivancho
 
me-electro u can never underestimate the info u get fron the datasheet, it seems easy to ignore at first, but eventually u will have to read some of it!

The 16F877 has an 8 channel 10 bit S/A A/D convertor, should u require the reading of an analog signal, this should be used. If it is digital then u will need to understand how to either transmit or receive data from the various pins u choose and again, this goes back to reading the spec. sheet unfortunately... :(
 
me-electro said:
hi...

I am a new member...

I am doing a project using PIC16F877...

and it's my first time using microcontrollers...

I want to reed a value using this PIC and store it in a register inside...

BUT... I don't know how...

SO... can any one who know it help me...

thaks alot...

:oops:
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top