CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

need help pls for manhester encoding

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
sacalu



Joined: 10 May 2007
Posts: 4

View user's profile Send private message

need help pls for manhester encoding
PostPosted: Thu May 10, 2007 5:35 am     Reply with quote

hey,this might be a stupid request but since i'm a newbie at this i'll do i anyway Smile .i want to encode manchester a character send via rs232....so here's my code


Code:

#include   "E:\PICC\Devices\16f88.h"
#use DELAY(clock=8000000,internal)
#use rs232(baud=9600, xmit=pin_b5,rcv=PIN_B2)
#use fixed_io(a_outputs=pin_a0)
#fuses intrc,mclr,noprotect,nowdt,nowrt,nolvp,noput,nocpd
void main()
{
int i,b=0;
char a,c,e1,e2;
int16 f,e=0x0000;
c=getch();
a=c;
for (i=0;i<7>>=2;
    if (c&&0x01)
   {e=e^0x8000;}
   
    else
   {e=e^0x4000;}
   c>>=1;
}
putchar(a);
f=e;
e1=f;
f>>=8;
e2=f;
/*while (b==0){
for (i=1;i<=7;i++)
{
    if (e2&&0x01)
    output_bit(pin_a0,1);
    else output_bit(pin_a0,0);}
    delay_ms(30);
}*/

for (i=1;i<=7;i++)
{
    if (e2&&0x01)
    output_bit(pin_a0,1);
    else output_bit(pin_a0,0);
}
    delay_ms(100);
for (i=1;i<=7;i++)
{
     if (e1&&0x01)
     output_bit(pin_a0,1);
     else output_bit(pin_a0,0);}
}



the questin is this code send's the 16 bit variable wright...if not can u suggest some way to do this


Last edited by sacalu on Thu May 10, 2007 6:57 am; edited 5 times in total
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Thu May 10, 2007 6:13 am     Reply with quote

We can't read your code as the forum interpreted some of the source code as HTML text. When posting code please tick the 'Disable HTML in this post' checkbox, also use the 'code' buttons in order to preserve the formatting.

Registering to this forum is free and gives the advantage that you can edit an earlier post. Also you can then set the 'Disable HTML in this post' as a default setting in your profile.

From the part of your code that is readable
Code:
 if (e2&&0x01)
Here you should use the 'bit wise' AND operator, now you are using the 'logical' AND (use & i.s.o. &&).

Use the search function of this forum, Manchester encoding has been discussed several times in the past.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group