 |
 |
| View previous topic :: View next topic |
| Author |
Message |
Poster Guest
|
|
Posted: Tue Feb 06, 2007 6:11 am |
|
|
| Just did a system restore. The working version was 4.013. |
|
 |
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Tue Feb 06, 2007 6:48 am |
|
|
If v4.023 isn't working while v4.013 is, then it most likely is a compiler bug. As suggested before in this thread, have you emailed your problem to CCS?
Again, this is a user's forum. CCS has an occassional look into what is going on here but bugs are to reported by email.
Why do you want to use a v4.xxx compiler version? The v4.xxx compilers are getting better with the recent releases but are still to be considered beta versions. For production quality software you are to use the latest stable release, v3.249. |
|
 |
Poster Guest
|
|
Posted: Tue Feb 06, 2007 7:41 am |
|
|
| Compiled the thing using 4.013 still get same error. I ll change the programming board and development board tomorrow and see how it goes. |
|
 |
Poster Guest
|
|
Posted: Fri Feb 09, 2007 2:41 am |
|
|
I've changed everything, Pic16f877, ads7816, programming board, development board, and I'm getting the same errors.
I've even tried creating the hex code from the compiler and using winpic800 to program the chip without using MPLAB but the output to hyperterminal is 0FFF no matter wat i input to the ADC input (0-5V).
The only difference between now and last time is I used 4.013d (demo) previously and I'm using 4.013 now.
can someone pls enlighten me? thanks....
| Code: |
#include <16F877.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000) //tell compiler clock is 20Mhz for delay function
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7) //baud rate 9600; output pin C6; input pin C7;
#define SPI_MODE_0_0 (SPI_L_TO_H | SPI_XMIT_L_TO_H)
#define SPI_MODE_0_1 (SPI_L_TO_H)
#define SPI_MODE_1_0 (SPI_H_TO_L)
#define SPI_MODE_1_1 (SPI_H_TO_L | SPI_XMIT_L_TO_H)
void main(){
/*Declare Variables*/
int8 msb,lsb; // 8 bit upper,lower, bit storage
int16 result;
//defined as char for transmitting using putc()
/*Initialise Ports*/
output_high(PIN_E2); //switch off CS for external ADC
/*Setup SPI*/
setup_spi(SPI_MASTER | SPI_MODE_0_0 | SPI_CLK_DIV_16);
//spi clock:20/16=1.25Mhz, T=0.8us
output_high(PIN_A0); //show SPI has started up
delay_ms(3); //delay for microcontroller to get ready
/*Data Acquisition & Transmission*/
while(true){
output_low(PIN_E2);
msb=spi_read(0x00);
lsb=spi_read(0x00);
output_high(PIN_E2);
result = make16(msb, lsb);
result &= 0x1FFE; // Mask off the top 3 bits and the LSB.
result >>= 1; // Shift it right by 1 bit.
//On Windows, an ASCII sequence CR LF (\r\n) (return followed by linefeed) ends each line.
printf("%lx\n\r", result);
delay_ms(4);
}
}
|
|
|
 |
|
|
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
|