DSPRelated.com
Forums

what on earth this PFs are amde up of,guys plz get me out of this

Started by ajax...@yahoo.co.in April 28, 2005
hai guys is any budy their who will this simple solve this simple issue ,
the task is just sending an word "AT" ,thru Programmable flags .
Since ia m begginner to this BF processor.
i am using BF532 processor

i am struggling by my self here no guidenec nor experinced one to guide me what ia m doing is right or rong
the task is very simple ,just sending the data thru PF13 which is set as output pin.Since the data type is of Char .but i am not able to make the char type in to binary type to send it in bit by bit.

*pFIO_FLAG_S = 0x0200;// is this right acording to the bit which one i need to togglt whether FlagS,Flag D,Flag C.

which one need to be set or clear according to the bit of the data to be sent on this Pf13 pin.

what on earth ,i am in.NO one is their to slove this simple issue
plz tell me where i am doing or going wrong .
here is the code i am sending

#include<stdio.h>
#include<stdlib.h>
#include<cdefbf532.h>
#include<sys\exception.h>
volatile unsigned int delay=0xff ;
volatile unsigned char DATA[]="AT";

EX_INTERRUPT_HANDLER(FlagA_ISR);
//prototypes
void Init_Flags(void);
void Init_Timer(void);
void Init_Interrupts(void);

void main(void)
{
Init_Flags(); //Initializing the flags(PF12,PF13)
Init_Timer(); //Initializing the timer0 in PWM mode
Init_Interrupts(); //Seting up the Ivg12 for Timer0
//The processor waits
while(1)
{ };

} //end main

void Init_Flags()
{
*pFIO_DIR |= 0x2000;//first intilaizie Direection reg
*pFIO_FLAG_S|=0x2000;//then set for out put flag i.e PF13
*pFIO_INEN |= 0x1000;//then set for input flag
*pFIO_POLAR |= 0x1000;//here the polarity set for flaginput to Active low(falling edge)
*pFIO_EDGE |= 0x1000;//Sensitivity reg used here pF12 is Edge sensitive
*pFIO_MASKA_S|= 0x1000;//Enabl input flagpin 12 for interrupt A generation
}// end intial flags

void Init_Timer()
{ *pTIMER0_CONFIG|=0x0019;//Seting it up in PWM mode
*pTIMER0_PERIOD|=0x01000000;//
*pTIMER0_WIDTH|=0x08000000;//
*pTIMER_ENABLE|=0x0001; // enabling the TImer zero.
}//END timer intilizations

void Init_Interrupts()
{
// assign core IDs to interrupts
*pSIC_IAR0 |= 0xffffffff;
*pSIC_IAR1 |= 0xffffffff;
*pSIC_IAR2 |= 0xffff5fff;// FlagA->IVG12
// assign ISRs to interrupt vectors
*pFIO_FLAG_C |=0x0000;
*pFIO_FLAG_S |=0x2000;

register_handler(ik_ivg12, FlagA_ISR);// should be used or not
*pSIC_IMASK|= 0x00080000;//enabling the interrupt of PF A
}// end,of Interrupts initil
EX_INTERRUPT_HANDLER(FlagA_ISR)
{

volatile char data[]="AT";
// first convert the Char data in to binary format
volatile int i,send=0x41;
while(!(*pTIMER_STATUS & 1));
*pTIMER_STATUS=0x0001;
asm("csync();");
//send the start bit
*pFIO_FLAG_S=0x0200;
asm("ssync;");

for( i = 0; i < 8; ++i )
{
//set or clear the PF13 based on the bit.
if(send & 1)
// if it is set then make
*pFIO_FLAG_S|=0x2000;
else
*pFIO_FLAG_C|=0x2000;
asm("ssync;");
asm("ssync;");

while((*pTIMER_STATUS&1));

*pTIMER_STATUS|=0x0001;

send >>=1;

}
// transmiting stop bits
while(!(*pTIMER_STATUS & 1));
*pTIMER_STATUS = 0x0001;
*pFIO_FLAG_S = 0x0200;// is this right acording to the bit which one i need to togglt whether S,D,C.
asm("ssync;");
*pFIO_FLAG_C = 0x0200;

asm("ssync;");
}

wating for the reply



On Thu, 28 Apr 2005 ajax_narayan@ajax... wrote:

> asm("csync();");
> //send the start bit
> *pFIO_FLAG_S=0x0200;
> asm("ssync;");
>
> for( i = 0; i < 8; ++i )
> {
> //set or clear the PF13 based on the bit.
> if(send & 1)
> // if it is set then make
> *pFIO_FLAG_S|=0x2000;
> else
> *pFIO_FLAG_C|=0x2000;
> asm("ssync;");
> asm("ssync;");
>
> while((*pTIMER_STATUS&1));
>
> *pTIMER_STATUS|=0x0001;
>
> send >>=1;
>
> }
> // transmiting stop bits
> while(!(*pTIMER_STATUS & 1));
> *pTIMER_STATUS = 0x0001;
> *pFIO_FLAG_S = 0x0200;// is this right acording to the bit which one i need to togglt whether S,D,C.
> asm("ssync;");
> *pFIO_FLAG_C = 0x0200;
>
> asm("ssync;");

don't mix assembler and C for this kind of thing. Write it completely
in assembler and make it work at the lowest possible level. then when
you understand the processor, you can deal with compiler problems.
Since you are just beginning you need to simplify things as much as
possible. Get one thing to work at a time and work your way up in
complexity.

Just see if you create a square wave on the output pin. After you have
that going, see if you can change the frequency of the square wave.
With those 2 working, you can create the correct bits at the correct baud.

Relax and take things one small step at a time. Every small success feels
just as good as one big one. And more success makes you feel good more
often :-)

Patience, persistence, truth,
Dr. mike


At 12:59 AM 4/28/2005, ajax_narayan@ajax... wrote:
>hai guys is any budy their who will this simple solve this simple issue ,
>the task is just sending an word "AT" ,thru Programmable flags .
>Since ia m begginner to this BF processor.
> i am using BF532 processor
>
>i am struggling by my self here no guidenec nor experinced one to
>guide me what ia m doing is right or rong
>the task is very simple ,just sending the data thru PF13 which is
>set as output pin.Since the data type is of Char .but i am not able
>to make the char type in to binary type to send it in bit by bit.
>
> *pFIO_FLAG_S = 0x0200;// is this right acording to
> the bit which one i need to togglt whether FlagS,Flag D,Flag C.
>
>which one need to be set or clear according to the bit of the data
>to be sent on this Pf13 pin.
>
>what on earth ,i am in.NO one is their to slove this simple issue
>plz tell me where i am doing or going wrong .
>here is the code i am sending
>
>#include<stdio.h>
>#include<stdlib.h>
>#include<cdefbf532.h>
>#include<sys\exception.h>
>volatile unsigned int delay=0xff ;
>volatile unsigned char DATA[]="AT";
>
>EX_INTERRUPT_HANDLER(FlagA_ISR);
>//prototypes
>void Init_Flags(void);
>void Init_Timer(void);
>void Init_Interrupts(void);
>
>void main(void)
>{
>Init_Flags(); //Initializing the flags(PF12,PF13)
>Init_Timer(); //Initializing the timer0 in PWM mode
>Init_Interrupts(); //Seting up the Ivg12 for Timer0
>//The processor waits
>while(1)
>{ };
>
>} //end main
>
>void Init_Flags()
>{
>*pFIO_DIR |= 0x2000;//first intilaizie Direection reg
>*pFIO_FLAG_S|=0x2000;//then set for out put flag i.e PF13
>*pFIO_INEN |= 0x1000;//then set for input flag
>*pFIO_POLAR |= 0x1000;//here the polarity set for flaginput to
>Active low(falling edge)
>*pFIO_EDGE |= 0x1000;//Sensitivity reg used here pF12 is Edge sensitive
>*pFIO_MASKA_S|= 0x1000;//Enabl input flagpin 12 for interrupt A generation
>}// end intial flags
>
>void Init_Timer()
>{ *pTIMER0_CONFIG|=0x0019;//Seting it up in PWM mode
> *pTIMER0_PERIOD|=0x01000000;//
> *pTIMER0_WIDTH|=0x08000000;//
> *pTIMER_ENABLE|=0x0001; // enabling the TImer zero.
>}//END timer intilizations
>
>void Init_Interrupts()
>{
>// assign core IDs to interrupts
>*pSIC_IAR0 |= 0xffffffff;
>*pSIC_IAR1 |= 0xffffffff;
>*pSIC_IAR2 |= 0xffff5fff;// FlagA->IVG12
>// assign ISRs to interrupt vectors
>*pFIO_FLAG_C |=0x0000;
>*pFIO_FLAG_S |=0x2000;
>
>register_handler(ik_ivg12, FlagA_ISR);// should be used or not
>*pSIC_IMASK|= 0x00080000;//enabling the interrupt of PF A
>}// end,of Interrupts initil
>EX_INTERRUPT_HANDLER(FlagA_ISR)
>{
>
> volatile char data[]="AT";
>// first convert the Char data in to binary format
> volatile int i,send=0x41;
> while(!(*pTIMER_STATUS & 1));
> *pTIMER_STATUS=0x0001;
> asm("csync();");
> //send the start bit
> *pFIO_FLAG_S=0x0200;
> asm("ssync;");

You are only going to be able to send out one bit at every interrupt
if your interrupt rate is set to 9600. This routine seems to send
out all bits in one bit time. You'll need to keep track of which bit
you are sending with a static or something so that each bit is spaced
at the 9600 ( approx 104us ) spacing.

> for( i = 0; i < 8; ++i )
> {
> //set or clear the PF13 based on the bit.
> if(send & 1)
> // if it is set then make
> *pFIO_FLAG_S|=0x2000;
> else
> *pFIO_FLAG_C|=0x2000;
> asm("ssync;");
> asm("ssync;");
>
> while((*pTIMER_STATUS&1));
>
> *pTIMER_STATUS|=0x0001;
>
> send >>=1;
>
> }
> // transmiting stop bits
> while(!(*pTIMER_STATUS & 1));
> *pTIMER_STATUS = 0x0001;
> *pFIO_FLAG_S = 0x0200;// is this right acording to
> the bit which one i need to togglt whether S,D,C.
> asm("ssync;");
> *pFIO_FLAG_C = 0x0200;
>
> asm("ssync;");
>}
>
>wating for the reply >
>

Steve Holle
Link Communications, Inc.
1035 Cerise Rd.
Billings, MT 59101
sholle@shol...


I was assuming you were using the interrupt as your timing source but
that doesn't appear to be the case. What triggers your interrupt?

At 08:06 AM 4/28/2005, Steve Holle wrote:
>At 12:59 AM 4/28/2005, ajax_narayan@ajax... wrote:
>>hai guys is any budy their who will this simple solve this simple issue ,
>>the task is just sending an word "AT" ,thru Programmable flags .
>>Since ia m begginner to this BF processor.
>> i am using BF532 processor
>>
>>i am struggling by my self here no guidenec nor experinced one to
>>guide me what ia m doing is right or rong
>>the task is very simple ,just sending the data thru PF13 which is
>>set as output pin.Since the data type is of Char .but i am not able
>>to make the char type in to binary type to send it in bit by bit.
>>
>> *pFIO_FLAG_S = 0x0200;// is this right acording to
>> the bit which one i need to togglt whether FlagS,Flag D,Flag C.
>>
>>which one need to be set or clear according to the bit of the data
>>to be sent on this Pf13 pin.
>>
>>what on earth ,i am in.NO one is their to slove this simple issue
>>plz tell me where i am doing or going wrong .
>>here is the code i am sending
>>
>>#include<stdio.h>
>>#include<stdlib.h>
>>#include<cdefbf532.h>
>>#include<sys\exception.h>
>>volatile unsigned int delay=0xff ;
>>volatile unsigned char DATA[]="AT";
>>
>>EX_INTERRUPT_HANDLER(FlagA_ISR);
>>//prototypes
>>void Init_Flags(void);
>>void Init_Timer(void);
>>void Init_Interrupts(void);
>>
>>void main(void)
>>{
>>Init_Flags(); //Initializing the flags(PF12,PF13)
>>Init_Timer(); //Initializing the timer0 in PWM mode
>>Init_Interrupts(); //Seting up the Ivg12 for Timer0
>>//The processor waits
>>while(1)
>>{ };
>>
>>} //end main
>>
>>void Init_Flags()
>>{
>>*pFIO_DIR |= 0x2000;//first intilaizie Direection reg
>>*pFIO_FLAG_S|=0x2000;//then set for out put flag i.e PF13
>>*pFIO_INEN |= 0x1000;//then set for input flag
>>*pFIO_POLAR |= 0x1000;//here the polarity set for flaginput to
>>Active low(falling edge)
>>*pFIO_EDGE |= 0x1000;//Sensitivity reg used here pF12 is Edge sensitive
>>*pFIO_MASKA_S|= 0x1000;//Enabl input flagpin 12 for interrupt A generation
>>}// end intial flags
>>
>>void Init_Timer()
>>{ *pTIMER0_CONFIG|=0x0019;//Seting it up in PWM mode
>> *pTIMER0_PERIOD|=0x01000000;//
>> *pTIMER0_WIDTH|=0x08000000;//
>> *pTIMER_ENABLE|=0x0001; // enabling the TImer zero.
>>}//END timer intilizations
>>
>>void Init_Interrupts()
>>{
>>// assign core IDs to interrupts
>>*pSIC_IAR0 |= 0xffffffff;
>>*pSIC_IAR1 |= 0xffffffff;
>>*pSIC_IAR2 |= 0xffff5fff;// FlagA->IVG12
>>// assign ISRs to interrupt vectors
>>*pFIO_FLAG_C |=0x0000;
>>*pFIO_FLAG_S |=0x2000;
>>
>>register_handler(ik_ivg12, FlagA_ISR);// should be used or not
>>*pSIC_IMASK|= 0x00080000;//enabling the interrupt of PF A
>>}// end,of Interrupts initil
>>EX_INTERRUPT_HANDLER(FlagA_ISR)
>>{
>>
>> volatile char data[]="AT";
>>// first convert the Char data in to binary format
>> volatile int i,send=0x41;
>> while(!(*pTIMER_STATUS & 1));
>> *pTIMER_STATUS=0x0001;
>> asm("csync();");
>> //send the start bit
>> *pFIO_FLAG_S=0x0200;
>> asm("ssync;");
>
>You are only going to be able to send out one bit at every interrupt
>if your interrupt rate is set to 9600. This routine seems to send
>out all bits in one bit time. You'll need to keep track of which
>bit you are sending with a static or something so that each bit is
>spaced at the 9600 ( approx 104us ) spacing.
>
>> for( i = 0; i < 8; ++i )
>> {
>> //set or clear the PF13 based on the bit.
>> if(send & 1)
>> // if it is set then make
>> *pFIO_FLAG_S|=0x2000;
>> else
>> *pFIO_FLAG_C|=0x2000;
>> asm("ssync;");
>> asm("ssync;");
>>
>> while((*pTIMER_STATUS&1));
>>
>> *pTIMER_STATUS|=0x0001;
>>
>> send >>=1;
>>
>> }
>> // transmiting stop bits
>> while(!(*pTIMER_STATUS & 1));
>> *pTIMER_STATUS = 0x0001;
>> *pFIO_FLAG_S = 0x0200;// is this right acording to
>> the bit which one i need to togglt whether S,D,C.
>> asm("ssync;");
>> *pFIO_FLAG_C = 0x0200;
>>
>> asm("ssync;");
>>}
>>
>>wating for the reply
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>
>Steve Holle
>Link Communications, Inc.
>1035 Cerise Rd.
>Billings, MT 59101
>sholle@shol...

Steve Holle
Link Communications, Inc.
1035 Cerise Rd.
Billings, MT 59101
sholle@shol...