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.

PIC16F877 maximum input bitstream speed

Status
Not open for further replies.

ceibawx

Junior Member level 2
Joined
Oct 13, 2008
Messages
24
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
chongqing,China
Activity points
1,606
shift_left pic16f8

What's the maximum input bitstream speed in PIC16F877?
My aim is 256kbps. but I failed.
There are results, but I don't understand.Using different output function ways, input speed maximum is not the same? Why?
Any information is appreciated.


----------------------------------------------------------------------------------
pic oscillator frequency is 20MHz. Input clock is the same frequency of input bitstream speed.Instance, input is 256kbps, and input clock is 256khz.
Input bitstream is replaced by function generator output square wave.

(1) input bitstream maximum value is 90kbps when using output_bit() to test output.
output_bit test code.

----------------------------
#include <16F877.h>
#include
#include
#include

#define GP0 PIN_C0 // CLOCK KHz
#define GP1 PIN_C1 //DATA Kbps
#define GP2 PIN_C2 //DATA OUTPUT_BIT
#define GP3 PIN_C6 // RS232 OUTPUT

#use delay(clock=20000000)
#use rs232(baud=115200, xmit=PIN_C6, rcv=PIN_C7, parity=N, bits=8, stream=TXBEE)

void main()
{
int eeg[80];
int i;

write_eeprom(10011000,6);

while(TRUE)
{
for (i=0;i<80;i++)
{
while (!input(GP0)); // input clock
eeg=input(GP1); //record bit input
output_bit(GP2,eeg); //test bit output
while (input(GP0)==1);
}
}
}
(2) input bitstream maximum value is 120kbps when using putc() to test output.
#include <16F877.h>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>

#define GP0 PIN_C0 // CLOCK 64KHZ
#define GP1 PIN_C1 //DATA 64KBAUD
#define GP2 PIN_C2 //DATA OUTPUT
#define GP3 PIN_C6 //UART OUTPUT

#use delay(clock=20000000)
#use rs232(baud=115200, xmit=PIN_C6, rcv=PIN_C7, parity=N, bits=8, stream=TXBEE)


void main()
{
int eeg[80],b;
int i,j,k;

while(TRUE)
{
int8 in_bits[10]; //only 10 bytes in memory, one bit per bit

//recieve 80 bits stream
for (i=0;i<80;i++)
{
while (input(GP0)==0);
shift_left(in_bits, 10, input(GP1)); //see help for shift_left function
while (input(GP0)==1);
}

//then send it
for (i=0;i<10;i++)
{
putc(in_bits);
output_toggle(PIN_C4);
delay_us(100);
output_toggle(PIN_C4);
}
}
}
 

pic16f877a maximum

Hi ceibawx.

Could you give us the detailed description of your project ?
Is your input stream continuous with 256KHz frequency or it's
set of 80-bit separated packages ?

Dou you understand, that at the time of sending received bytes you can
miss the input stream, otherwise you are using interrupts for recieving inputs stream and sending it in background.

Pleasu use tags CODE when you posting your source code .
And again, your code contains bugs such a

Code:
for (i=0;i<10;i++) 
{ 
   putc(in_bits);  //<-  in_bits is an array of 10 bytes, please use it with index
                        //  putc(in_bits[i]);  <- this is the correct version(as I gave you)
   output_toggle(PIN_C4); 
   delay_us(100); 
   output_toggle(PIN_C4); 
}

My answer is YES: you can achieve the speed of 256KHZ of input stream,
but you need to optimize your program .
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top