Re: newbee question

Scott Henion <[email protected]>
Newsgroups gmane.comp.hardware.rabbit-semiconductor
Message-ID <[email protected]>
On 2/28/2013 9:41 PM, Sylvain Bissonnette wrote:
>
> Hi
>
>    I'm comming from another world of MCU and I'm at the beginning of
> my long lurning curve,  Here is what I'm trying to do:
>
> The main question is why nothing work...
>
> #define RS      1   
> #define RS_SET          BitWrPortI(PCDR, &PCDRShadow, 1, RS);
> #define RS_CLR          BitWrPortI(PCDR, &PCDRShadow, 0, RS);
>
> main()
> {  
>    int i;
>
>    for (i=0;i<7;i++)
>    {
>      //BitWrPortI(PADDR,&PADDRShadow,1,(1<<i)); why this line don't
> compile?
>       BitWrPortI(PBDDR,&PBDDRShadow,1,(1<<i));
>       BitWrPortI(PCDDR,&PCDDRShadow,1,(1<<i));
>    }
>
>   while(1)
>   {
>   
>    RS_SET; 
>    WrPortI(PADR,    &PADRShadow,i++);    
>    RS_CLR;  
>    }
> }

You need to set port A as an output, look at the SPCR docs:

At start, add WrPortI(SPCE,SPCRShadow,0x84);

-- 
------------------------------------------
     Scott G. Henion, Consultant
Web site:    http://SHDesigns.org
------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.