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.

[PIC] Using dsPIC3of control step motor

Status
Not open for further replies.
These can be replaced


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
if (LATD == 0b0001) LATD = 0b0010;
    else if (LATD == 0b0010) LATD = 0b0100;
    else if (LATD == 0b0100) LATD = 0b1000;
    else if (LATD == 0b1000) LATD = 0b0001;
    else LATD = 0b0001;
 
 
 
if (LATD == 0b0001) LATD = 0b1000;
    else if (LATD == 0b0010) LATD = 0b0001;
    else if (LATD == 0b0100) LATD = 0b0010;
    else if (LATD == 0b1000) LATD = 0b0100;
    else LATD = 0b0001;



by these


Code C - [expand]
1
2
3
4
5
6
7
if(LATD == 0x08)LATD = 0x01 
else LATD <<= 1;
 
 
 
if(LATD == 0x01)LATD = 0x08 
else LATD >>= 1;



//or


Code C - [expand]
1
2
3
4
5
6
7
if((LATD & 0x0F) == 0x08)LATD = LATD & 0xF1 
else LATD <<= 1;
 
 
 
if((LATD & 0x0F) == 0x01)LATD = LATD & 0xF8
else LATD >>= 1;

 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top