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.

Display analog output proplem

chilly85

New Member
Hi all,
I'm working with ADC in PIC16F877. The output is written on PortC in 8 bit.Could I display this output in 3 bit? For example
PortC = 11111111 -> PortE = 111
PortC = 01111011 -> PortE = 011
PortC = 00010001 -> PortE = 010
Could I do something like this? (I checked but not worked)
Code:
movlw B'01111011'
xorwf PortC,w
btfss status,z
movlw B'00000011'
movwf PortE
The problem here is that can I do xorwf with the PortC which is writen by output of ADC process)
 
Last edited:
Hi all,
I'm working with ADC in PIC16F877. The output is written on PortC in 8 bit.Could I display this output in 3 bit? For example
PortC = 11111111 -> PortE = 111
PortC = 01111011 -> PortE = 011
PortC = 00010001 -> PortE = 010
Could I do something like this? (I checked but not worked)
Code:
movlw B'01111011'
xorwf PortC,w
btfss status,z
movlw B'00000011'
movwf PortE

hi,
It would be better if you told us whats the need for doing it this way.:)
 
Hi Eric,
I would like to send the output from PIC to computer by parallel port
But in parallel port I have only 3 bit (3 pin ) to read this data.
That's why I have to change from 8bit to 3 bit
 
Hi Eric,
I would like to send the output from PIC to computer by parallel port
But in parallel port I have only 3 bit (3 pin ) to read this data.
That's why I have to change from 8bit to 3 bit

You understand you can only represent 0 to 7 states with 3 bits.

Divide the 255 value by 16, right shifts required.

Q1: why have you only got 3 bits available on the PC's paraport.?
 
Last edited:
If you have only 3 bits then send it serial. Use the bits as Enable, Clock & Data. The enable will allow you to recover if a bit is somehow missed when windoze goes of on one of it's tea breaks.:rolleyes:

Mike.
 
You understand you can only represent 0 to 7 states with 3 bits.

Divide the 255 value by 16, right shifts required.

Q1: why have you only got 3 bits available on the PC's paraport.?

In the parallel port I have 8 pin for input and output.But I used 5 pins for output already. So I have 3 pins left for input
 
If you have only 3 bits then send it serial. Use the bits as Enable, Clock & Data. The enable will allow you to recover if a bit is somehow missed when windoze goes of on one of it's tea breaks.:rolleyes:

Mike.
Hi Mike,
Did you mean that I have to use 3 bits like: 1 bit for Enable, 1 bit for Clock, 1 bit for Data?
Could you explain more detail?
 
In the parallel port I have 8 pin for input and output.But I used 5 pins for output already. So I have 3 pins left for input

If I follow correctly, you dont understand the parallel port configuration.

Can you say how you are using the '5 pins'.?
 
If I follow correctly, you dont understand the parallel port configuration.

Can you say how you are using the '5 pins'.?
I'm not sure what I'm doing is correct or not. Each I/O pin of parallel port I connect to outside circuit by a wire. So I can use each pin separately (from D0 to D7)
By the way, I will read more about parallel port configuration.
Thanks Eric
 
Last edited:
I'm not sure what I'm doing is correct or not. Each I/O pin of parallel port I connect to outside circuit by a wire. So I can use each pin separately (from D0 to D7)

hi,
D0 thru D7 are normally configured as PC output pins.

They can be configured by the PC's program as inputs if required.

It would help if you could post a sketch of what you have connected to the port.:)

EDIT: this table may help.
 

Attachments

  • esp02 Sep. 25.gif
    esp02 Sep. 25.gif
    26.4 KB · Views: 181
Last edited:
Data is data, it's up to you what you do with it once it's in the PC - I've no idea what Labview is capable of, but Hyperterminal will read the data and store it in a file.
Thanks for your suggestion.
I would like to thank for your PIC tutorial online too. I have learn a lot from that.
 
hi,
D0 thru D7 are normally configured as PC output pins.

They can be configured by the PC's program as inputs if required.

It would help if you could post a sketch of what you have connected to the port.:)

EDIT: this table may help.
The parallel I'm using is bi-directional one. So I can use D0-D7 as input or output
 

Latest threads

Back
Top