Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Parallel in serial out programming for PIC16F84

Status
Not open for further replies.

gg

Junior Member level 3
Joined
Jun 12, 2004
Messages
31
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
349
i want to know that PIC16F84 can be input as parallel and output as serial. Actually, i want my data from PIC go into RS-232. Is there any example for parallel in serial out programming???
Fast forward, i want to thanks for those who help me.
 


tx rx pic16f84a

Hi there..i am currently using a PIC16F84A.

I am doing exactly the opposite of that guy(gg), which is serial to parallel data conversion.

Are those websites stated above suitable for my application?
Thanks alot!
 

download pic16f84a simulator

Not hard to do that. Just an idea here.

Use external pin changed interrupt to trigger the operation. When this happens, read the port value and then shift it out at another pin, bit by bit.
 

pic16f84 bitbanging

Thanks hill!:)

Actually i am not PIC16F84 savvy. I just learn that few days ago.

I found your idea is quite interesting. Can you tell me more about that?
 

pic16f84 tone generator

cwt said:
Thanks hill!:)

Actually i am not PIC16F84 savvy. I just learn that few days ago.

I found your idea is quite interesting. Can you tell me more about that?

I assume that your data length is 8 bits. Set up 8 input lines to read this 8 bit data. Additionally, 1 more input line to act as a CLK to trigger the conversion. So you can use interrupt to intercept that. With 8 bits of data plus the start/stop bits, you have total of 10 bits. This requires 2 registers to hold the data.

Start D7 D6 D5 D4 D3 D2 D1 | D0 Stop X X X X X X
TEMP_REG TEMP_REG+1

Once you have verify the CLK in your ISR, start left-shifting those registers.

A: RLF TEMP_REG+1, F
RLF TEMP_REG, F

Next you test the value of C and set the output pin with this value. Then wait for a time
(1/baudrate) – (time from A: until now).

Go back to A:. Repeat that until all bit are shifted out.
 

pic16f84 uart 10 bit

Some correction.

You could use Port B to read the data. By using PORTB changed interrupt, you can save the need of CLK.

By the way, I doubt that if you still can get PIC16F84 now day. Why not choose a PIC with hardware USART?
 

instruction cycle time for pic16f84

Alright thanks anyway..
I already have one of the PIC.
No CLK for my PIC??No crystal oscillator?!
 

microchip +pic16f84 +usart

Can i write my program in this order?

Serial input at port A.
Loop until detect the start bit.
Then move the remaining 8bits into a register.
Next, rotate those bits and output them in the port B pins.
Repeat the whole process.

:)
 

PIC16F84

Wait!

Sorry. I was talking about parallel to serial. But what you want is serial to parallel.
 

Re: PIC16F84

cwt said:
Alright thanks anyway..
I already have one of the PIC.
No CLK for my PIC??No crystal oscillator?!

Which PIC that you have? Is it with hardware USART?
 

Re: PIC16F84

The basic idea of bit-banging is to manipulate bitwise I/O to fit a protocol, in this case, the RS232 serial protocol. It's just that simple.
During tx, just ensure you transmit the startbit+data-byte+stopbit synchronised to your baudrate. During rx, just listen for the startbit, then read the subsequent data byte and stopbit at a rate determined by your baudrate. It's not really that difficult to do. All you need to know is simple knowledge of single-pin I/O, as well as the use of the on-chip timer to synchronize with the baudrate. As for listening for the startbit, you can either use an edge interrupt or polling.
Of course, the easiest solution is to use a PIC with hardware UART. All you have to do is to initialize some registers, then TX/RX operations are simply byte transfer operations between some registers. This saves external interrupt and timer peripherals, which can be reserved for other more important operations. If possible, dump the 16F84 for a 16F628. They are virtually one-to-one replacements (ie virtually no code changes required), but with hardware UART, and they cost around the same.

P.S. implementing a software UART may be good starter for PIC programming. Besides, it gives you some experience to understanding protocols. Much of digital electronics requires nothing much more than understanding protocols and specifications.
 

PIC16F84

I am using a PIC16F84A.
 

Re: PIC16F84

About the parallel-in-serial-out of PIC16F84A, how can i generate a start and stop bit??? I required the start and stop bit because i wanted to send the data into the computer through rs-232 cable.

Next question: I'm inputting various of binary data parallelly such as 10101,11000,10111 and so on into my PIC. From my shallow knowledge on PIC, i only know that the PIC can able read the input data by using BTFSC or BTFSS. By using this two instuctions, it can only compare the data inputted with the bit required in the PIC. I think all of you are blur on what i say, let me give an example:

START .....
BTFSS PORTA,0
GOTO START
carry on here

If bit 0 in portA is set to a 1, it will skip the GOTO instruction and continue with the next instructions.

I want my PIC to accept any binary data from PORTA and store temporarily in my register. How can i do that???
 

PIC16F84

Hi out there..just want to know something about the instruction cycle.

If i am using a 4Mhz crystall, one instruction requires how long to be executed?(in seconds)

1 cycle is how long?
 

Re: PIC16F84

in 16f84,1 cycle is 1us,the speed is 1mhz (clock /4)...many instructions are single cycle,except branch instructions,which are 2 cycles long
 

PIC16F84

I learn much from these topic.You guys have so much knowlage for sharing, this really make me ashamed.
 

Re: PIC16F84

hi

It is a program for development and simulation of software for the PIC16F84 microcontroller made by Microchip. With this program you can write the code, build it and test if it works in a few seconds. While debugging, you see the internal content of all registers. Compare this to developing without a simulator, after you have programmed the microcontroller you have to put in your circuit. If it doesn't work, it's not easy to find the bug. With the simulator you can step through each instruction to make sure everything goes as expected.



PIC Development Studio is not just only a PIC16F84 simulator. You can simulate entire digital projects provided that the needed components are available. You connect the components together just as they would be in reality and start the simulation. There are included keyboards, simple displays, basic logic circuits, a tone generator and an oscilloscope probe. If these don't fulfil your needs, writing own components isn't hard. See development for more information


**broken link removed**

or an other nice tool

https://sourceforge.net/project/showfiles.php?group_id=102194&package_id=109693&release_id=243774
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top