![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
Homie
Joined: 11 Aug 2006 Posts: 11
|
Help needed converting MSP430 code to PIC16F877(CCS) |
Posted: Sun Aug 13, 2006 12:50 pm |
|
|
Code: | P3OUT = IOR | IOW; // reset outputs, control lines high
P3DIR = 0xff; |
Hvad does this statement mean?? Set PIN IOR and IOW high???
Code: | BCSCTL1 &= ~DIVA0; // ACLK = XT1 / 4 = 2 MHz
BCSCTL1 |= DIVA1; //DIVA0=0x10, DIVA1=0x20
TACTL = ID_3 + TASSEL_1 + MC_2 + TAIE; |
Hvad does these 3 lines do exatcly???
Last question is not MSP430 related
Code: | //unsigned int TxFrame1Mem[(ETH_HEADER_SIZE + IP_HEADER_SIZE + TCP_HEADER_SIZE + MAX_TCP_TX_DATA_SIZE + 1) >> 1]; |
what can i be when the compiler says "subscript out of range"??? (PCM)
Is there a doc or a web site where you can see these comands for MSP430?? |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Aug 13, 2006 2:07 pm |
|
|
Quote: | What does this statement mean ? Set PIN IOR and IOW high ? |
It appears that you got the C source file from here.
http://focus.ti.com/mcu/docs/mcusupporttechdocsc.tsp?sectionId=96&tabId=1502&abstractName=slaa137a
Download the PDF file on that page and look at the schematic on page 30.
It shows that two pins on the MSP430 connect to the IOR and IOW pins
on the CS8900A chip. Then, in the Code zip file that can be downloaded
at the link above, look in the CS8900.H file. It has these two statements:
Code: |
#define IOR (0x40) // CS8900's ISA-bus interface pins
#define IOW (0x80)
|
Compare the bitmasks given in those statements to the schematic. The
schematic shows that signals /IOR and /IOW are on pins P3.6 and P3.7
of the MSP430. Those bitmasks correspond to those pin numbers:
0x40 = 0b01000000
0x80 = 0b10000000
Now look at the code:
Quote: |
P3OUT = IOR | IOW; // reset outputs, control lines high
P3DIR = 0xff;
|
P3OUT is an i/o port register, similar to Port C on a PIC. P3DIR is
similar to the TRISC register on a PIC. However, the bit polarity
is reversed for P3DIR, compared to TRISC. 0xFF means all outputs
in the MSP430, but in a PIC it means to set the TRIS to all inputs.
You have to keep this in mind when translating the code.
The code could be translated to the following, if using #fast_io mode:
Code: |
#byte PortC = 0x7 // Address for a 16F877
void main()
{
PortC = IOR | IOW;
set_tris_c(0x00);
|
For standard i/o mode, this would work:
Code: | void main()
{
output_c(IOR | IOW);
|
Quote: | What do these 3 lines do exactly ? |
They're setting up the "basic clock" register inside the MSP430.
Quote: | Is there a doc or a web site where you can see these comands for MSP430?? |
Download data sheet from manufacturer's website:
http://focus.ti.com/docs/prod/folders/print/msp430f149.html
To convert this code, you need a complete knowledge of the PIC
hardware, the MSP430 hardware, the CS8900A hardware, etc.
This includes internal register maps. You also need a complete
knowledge of the CCS compiler (especially data type sizes) and
whatever compiler was used for the MSP430 code.
I don't want to do this project for you. Please don't PM me, asking
for help. You must do the project. Also, please don't start a new
thread every time you have a question. Keep it on the same thread.
Remember, you must read all the docs and do the project. |
|
![](templates/subSilver/images/spacer.gif) |
Homie
Joined: 11 Aug 2006 Posts: 11
|
|
Posted: Sun Aug 13, 2006 6:05 pm |
|
|
Thanks for the help mate, i had the most figured out in the mean time tho
Ofcourse i wont PM you, if i have questions ill it post here. Thats what the forum is here for. And i dont want you to do the project for me, its something i do for fun while i have vacation. Im doing it to learn about webservers and internet. Btw im almost done, i just need to figure thing thing out with the timer/clock. |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|