CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Why does this code stop
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Ringo42



Joined: 07 May 2004
Posts: 263

View user's profile Send private message

Why does this code stop
PostPosted: Wed Feb 25, 2015 12:32 pm     Reply with quote

Can someone please look at this and tell me why it stops after line 71.
On the output I get the initial stuff then I get to "RSSI 3" and then nothing.
If I comment out lines 75 to 85 then it runs. What is killing it there?

Thanks
Ringo

Code:

#include "18f452.h"
#fuses hs,WDT8,noprotect,put,nolvp
#device adc=10
#device HIGH_INTS=TRUE
#use delay(clock=20000000,restart_wdt)
#include <stdlib.h>

#define LED1_PIN    PIN_B6
#define LED2_PIN    PIN_B7
#define TX_PIN      PIN_C6
#define RX_PIN      PIN_C7
#define BAUD_RATE 19200
#define Mux_sel     PIN_E2

#use rs232(baud=BAUD_RATE,xmit=TX_PIN,rcv=RX_PIN,errors,bits=8,parity=N,restart_wdt)
///Macros
#define LED1_ON output_high(LED1_PIN)
#define LED2_ON output_high(LED2_PIN)
#define LED1_OFF output_low(LED1_PIN)
#define LED2_OFF output_low(LED2_PIN)


void CheckRssi();
void InitPic();
void main()
{
   setup_wdt(WDT_ON);
   setup_timer_0(RTCC_INTERNAL);

    printf("ABC\r\n   >");
   
   InitPic();       
    printf("\r\n\nMotherboard RX, firmware 3n   >\r\n");
    printf("\r\n>");
   
    set_adc_channel( 5 );
    delay_ms(1);
    while (1)
    {
        CheckRssi();
        restart_wdt();
    }
}

void CheckRssi()
{
    int channel;
    int RSSI=0;
    int RSSIcounter=0;
    set_adc_channel( 5 );
    delay_ms(1);
    RSSI = Read_ADC();
    delay_ms(100);
    printf("RSSI!!!!!!!!!!!! \r\n");

    if(RSSI >100) // If radio is detected, but up counter a bunch
   {
        RSSIcounter+=10;
      output_high(PIN_E1);
   }
   else
   {
        RSSIcounter-=1;//else slowly count down to make sure radio is really off
      output_low(PIN_E1);
   }
    printf("RSSI 2\r\n");
    if(RSSIcounter >244)
        RSSIcounter=244;
    if(RSSIcounter <2)
        RSSIcounter=2;
    printf("RSSI 3 \r\n");
   

       
    if(RSSIcounter > 30)//if the radio is seen a few times
    {
        output_high(MUX_Sel);//radio   
      output_high(PIN_B2);         
    }
   
    else
    {
        output_low(MUX_sel);//usb
      output_low(PIN_B2);
    }

    printf("RSSI 4 \r\n");

    printf("RSSI= %u    RSSIcounter= %u \r\n",RSSI,RSSIcounter);
       
}

void InitPic()
{
     short int dummy_variable;
     setup_adc_ports(All_ANALOG);
    setup_adc( ADC_CLOCK_INTERNAL );
    setup_spi(FALSE);
    setup_psp(PSP_DISABLED);
    setup_timer_2(T2_DIV_BY_4,128,16);// 18.6 khz 0-512 int every 8ms //
    setup_timer_0(RTCC_Internal|RTCC_div_2);
 
//    enable_interrupts(INT_RDA);    // Serial Data Available IRQ
    enable_interrupts(INT_TIMER2); // Timer 2 Overflow
//    enable_interrupts(global);     // Enable IRQs
   
    dummy_variable = input(PIN_E0);
    output_low(PIN_E1);
    output_low(PIN_B2);
    output_low(PIN_E2);//mux_sel

    input(pin_a4);//RTS       
    port_b_pullups(false);
}

_________________
Ringo Davis
temtronic



Joined: 01 Jul 2010
Posts: 9229
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Feb 25, 2015 1:04 pm     Reply with quote

first.....

Quote:
If I comment out lines 75 to 85 then it runs. What is killing it there?

We have NO idea what these lines are, without seeing the actual listing ( filename.lst)


2nd. You have the WDT enabled which during the 'debugging' phase of code creation could( will) cause no end of problems.

3rd. You should post compiler version..might be a bug...

4th. RSSI looks like a 'radio peripheral' is connected to the PIC. Now if the PIC is running off 5 volts and the 'radio' is running off 3 volts, that can be a HUGE issue.

5th...
setup_adc( ADC_CLOCK_INTERNAL );

best check the datasheet, adc section, at 20MHz this won't be a valid value..

It'd be nice to see a schematic or more info as to what the hardware is(mfr/model/etc.)

The more info you give us, the faster/better the responses.

Jay
Ringo42



Joined: 07 May 2004
Posts: 263

View user's profile Send private message

PostPosted: Wed Feb 25, 2015 1:32 pm     Reply with quote

Thanks for the help,
I narrowed it down to the line
//output_high(MUX_Sel);//radio

with it commented out it runs.

The .lst file is below.

I'll disable watchdog for now

Compiler Version 4.007

I'll change the ADc to ADC_CLOCK_DIV_32. It is listed as have a max freq of 20mhz. In the pic datasheet there is a div/64 but I dont see that option in the CCS manual, should I use something else?

You are correct the radio is 3.3V and the pic is 5V, but the only problem I see with this is not getting full range correct? The Rssi is a PWM value that I filter into an analog signal.

I can send a schematic, but don't see how to attach it here. Am I missing an attachment button somewhere?






[code:1:392b684fcf]
CCS PCH C Compiler, Version 4.007, 34836 25-Feb-15 13:42

Filename: C:\Users\Hardware\Dropbox\21st century\Firmware\21_Rx_V3N_rssi_test.lst

ROM used: 884 bytes (3%)
Largest free fragment is 31884
RAM used: 14 (1%) at main() level
23 (1%) worst case
Stack: 3 locations

*
0000: GOTO 029C
.................... #include "18f452.h"
.................... //////// Standard Header file for the PIC18F452 device ////////////////
.................... #device PIC18F452
.................... #list
....................
.................... #fuses hs,WDT8,noprotect,put,nolvp
.................... #device adc=10
.................... #device HIGH_INTS=TRUE
.................... #use delay(clock=20000000,restart_wdt)
*
00F4: CLRF FEA
00F6: MOVLW 0F
00F8: MOVWF FE9
00FA: MOVF FEF,W
00FC: BZ 0120
00FE: MOVLW 06
0100: MOVWF 01
0102: MOVLW BF
0104: MOVWF 00
0106: CLRWDT
0108: DECFSZ 00,F
010A: BRA 0106
010C: DECFSZ 01,F
010E: BRA 0102
0110: MOVLW 7A
0112: MOVWF 00
0114: DECFSZ 00,F
0116: BRA 0114
0118: BRA 011A
011A: CLRWDT
011C: DECFSZ FEF,F
011E: BRA 00FE
0120: RETLW 00
.................... #include <stdlib.h>
.................... ///////////////////////////////////////////////////////////////////////////
.................... //// (C) Copyright 1996,2003 Custom Computer Services ////
.................... //// This source code may only be used by licensed users of the CCS C ////
.................... //// compiler. This source code may only be distributed to other ////
.................... //// licensed users of the CCS C compiler. No other use, reproduction ////
.................... //// or distribution is permitted without written permission. ////
.................... //// Derivative programs created using this software in object code ////
.................... //// form are not restricted in any way. ////
.................... ///////////////////////////////////////////////////////////////////////////
....................
.................... #ifndef _STDLIB
.................... #define _STDLIB
....................
.................... //---------------------------------------------------------------------------
.................... // Definitions and types
.................... //---------------------------------------------------------------------------
....................
.................... #ifndef RAND_MAX
.................... #define RAND_MAX 32767 // The value of which is the maximum value
.................... // ... returned by the rand function
.................... #endif
....................
.................... typedef struct {
.................... signed int quot;
.................... signed int rem;
.................... } div_t;
....................
.................... typedef struct {
.................... signed long quot;
.................... signed long rem;
.................... } ldiv_t;
....................
.................... #include <stddef.h>
.................... ///////////////////////////////////////////////////////////////////////////
.................... //// (C) Copyright 1996,2003 Custom Computer Services ////
.................... //// This source code may only be used by licensed users of the CCS C ////
.................... //// compiler. This source code may only be distributed to other ////
.................... //// licensed users of the CCS C compiler. No other use, reproduction ////
.................... //// or distribution is permitted without written permission. ////
.................... //// Derivative programs created using this software in object code ////
.................... //// form are not restricted in any way. ////
.................... ///////////////////////////////////////////////////////////////////////////
....................
.................... #ifndef _STDDEF
....................
.................... #define _STDDEF
....................
.................... #if sizeof(int *)==1
.................... #define ptrdiff_t int
.................... #else
.................... #define ptrdiff_t long
.................... #endif
....................
.................... #define size_t int
.................... #define wchar_t char
.................... #define NULL 0
....................
.................... #define offsetof(s,f) (offsetofbit(s,f)/8)
....................
.................... #endif
....................
....................
.................... //---------------------------------------------------------------------------
.................... // String conversion functions
.................... //---------------------------------------------------------------------------
....................
.................... /* Standard template: float atof(char * s)
.................... * converts the initial portion of the string s to a float.
.................... * returns the converted value if any, 0 otherwise
.................... */
.................... float atof(char * s);
....................
.................... /* Standard template: float atoe(char * s)
.................... * converts the initial portion of the string s to a float.
.................... * returns the converted value if any, 0 otherwise
.................... * also handles E format numbers
.................... */
.................... float atoe(char * s);
....................
.................... /* Standard template: signed int atoi(char * s)
.................... * converts the initial portion of the string s to a signed int
.................... * returns the converted value if any, 0 otherwise
.................... */
.................... signed int atoi(char *s);
....................
.................... /* Syntax: signed int32 atoi32(char * s)
.................... converts the initial portion of the string s to a signed int32
.................... returns the converted value if any, 0 otherwise*/
.................... signed int32 atoi32(char *s);
....................
.................... /* Syntax: char * itoa(signed int32 num, int8 base, char * s)
.................... converts the signed int32 to a string and
.................... returns the converted value if any, 0 otherwise*/
.................... char * itoa(signed int32 num, int8 base, char * s);
....................
.................... /* Standard template: signed long atol(char * s)
.................... * converts the initial portion of the string s to a signed long
.................... * returns the converted value if any, 0 otherwise
.................... */
.................... signed long atol(char *s);
....................
.................... /* Standard template: float strtol(char * s,char *endptr)
.................... * converts the initial portion of the string s to a float
.................... * returns the converted value if any, 0 otherwise
.................... * the final string is returned in the endptr, if endptr is not null
.................... */
.................... float strtod(char *s,char *endptr);
....................
.................... /* Standard template: long strtoul(char * s,char *endptr,signed int base)
.................... * converts the initial portion of the string s, represented as an
.................... * integral value of radix base to a signed long.
.................... * Returns the converted value if any, 0 otherwise
.................... * the final string is returned in the endptr, if endptr is not null
.................... */
.................... signed long strtol(char *s,char *endptr,signed int base);
....................
.................... /* Standard template: long strtoul(char * s,char *endptr,signed int base)
.................... * converts the initial portion of the string s, represented as an
.................... * integral value of radix base to a unsigned long.
.................... * returns the converted value if any, 0 otherwise
.................... * the final string is returned in the endptr, if endptr is not null
.................... */
.................... long strtoul(char *s,char *endptr,signed int base);
....................
.................... //---------------------------------------------------------------------------
.................... // Pseudo-random sequence generation functions
.................... //---------------------------------------------------------------------------
....................
.................... /* The rand function computes a sequence of pseudo-random integers in
.................... * the range 0 to RAND_MAX
.................... *
.................... * Parameters:
.................... * (none)
.................... *
.................... * Returns:
.................... * The pseudo-random integer
.................... */
.................... long rand(void);
....................
.................... /* The srand function uses the argument as a seed for a new sequence of
.................... * pseudo-random numbers to be returned by subsequent calls to rand.
.................... *
.................... * Parameters:
.................... * [in] seed: The seed value to start from. You might need to pass
.................... *
.................... * Returns:
.................... * (none)
.................... *
.................... * Remarks
.................... * The srand function sets the starting point for generating
.................... * a series of pseudorandom integers. To reinitialize the
.................... * generator, use 1 as the seed argument. Any other value for
.................... * seed sets the generator to a random starting point. rand
.................... * retrieves the pseudorandom numbers that are generated.
.................... * Calling rand before any call to srand generates the same
.................... * sequence as calling srand with seed passed as 1.
.................... * Usually, you need to pass a time here from outer source
.................... * so that the numbers will be different every time you run.
.................... */
.................... void srand(unsigned int32 seed);
....................
.................... //---------------------------------------------------------------------------
.................... // Memory management functions
.................... //---------------------------------------------------------------------------
....................
.................... // Comming soon
....................
.................... //---------------------------------------------------------------------------
.................... // Communication with the environment
.................... //---------------------------------------------------------------------------
....................
.................... /* The function returns 0 always
.................... */
.................... signed int system(char *string);
....................
.................... //---------------------------------------------------------------------------
.................... // Searching and sorting utilities
.................... //---------------------------------------------------------------------------
....................
.................... /* Performs a binary search of a sorted array..
.................... *
.................... * Parameters:
.................... * [in] key: Object to search for
.................... * [in] base: Pointer to base of search data
.................... * [in] num: Number of elements
.................... * [in] width: Width of elements
.................... * [in] compare: Function that compares two elements
.................... *
.................... * Returns:
.................... * bsearch returns a pointer to an occurrence of key in the array pointed
.................... * to by base. If key is not found, the function returns NULL. If the
.................... * array is not in order or contains duplicate records with identical keys,
.................... * the result is unpredictable.
.................... */
.................... //void *bsearch(const void *key, const void *base, size_t num, size_t width,
.................... // int (*compare)(const void *, const void *));
....................
.................... /* Performs the shell-metzner sort (not the quick sort algorithm). The contents
.................... * of the array are sorted into ascending order according to a comparison
.................... * function pointed to by compar.
.................... *
.................... * Parameters:
.................... * [in] base: Pointer to base of search data
.................... * [in] num: Number of elements
.................... * [in] width: Width of elements
.................... * [in] compare: Function that compares two elements
.................... *
.................... * Returns:
.................... * (none)
.................... */
.................... //void *qsort(const void *base, size_t num, size_t width,
.................... // int (*compare)(const void *, const void *));
....................
.................... //---------------------------------------------------------------------------
.................... // Integer arithmetic functions
.................... //---------------------------------------------------------------------------
....................
.................... #define labs abs
....................
.................... div_t div(signed int numer,signed int denom);
.................... ldiv_t ldiv(signed long numer,signed long denom);
....................
.................... //---------------------------------------------------------------------------
.................... // Multibyte character functions
.................... //---------------------------------------------------------------------------
....................
.................... // Not supported
....................
.................... //---------------------------------------------------------------------------
.................... // Multibyte string functions
.................... //---------------------------------------------------------------------------
....................
.................... // Not supported
....................
....................
.................... //---------------------------------------------------------------------------
.................... // Internal implementation
.................... //---------------------------------------------------------------------------
....................
.................... #include <stddef.h>
.................... ///////////////////////////////////////////////////////////////////////////
.................... //// (C) Copyright 1996,2003 Custom Computer Services ////
.................... //// This source code may only be used by licensed users of the CCS C ////
.................... //// compiler. This source code may only be distributed to other ////
.................... //// licensed users of the CCS C compiler. No other use, reproduction ////
.................... //// or distribution is permitted without written permission. ////
.................... //// Derivative programs created using this software in object code ////
.................... //// form are not restricted in any way. ////
.................... ///////////////////////////////////////////////////////////////////////////
....................
.................... #ifndef _STDDEF
....................
.................... #define _STDDEF
....................
.................... #if sizeof(int *)==1
.................... #define ptrdiff_t int
.................... #else
.................... #define ptrdiff_t long
.................... #endif
....................
.................... #define size_t int
.................... #define wchar_t char
.................... #define NULL 0
....................
.................... #define offsetof(s,f) (offsetofbit(s,f)/8)
....................
.................... #endif
....................
.................... #include <string.h>
.................... ////////////////////////////////////////////////////////////////////////////
.................... //// (C) Copyright 1996,2003 Custom Computer Services ////
.................... //// This source code may only be used by licensed users of the CCS C ////
.................... //// compiler. This source code may only be distributed to other ////
.................... //// licensed users of the CCS C compiler. No other use, reproduction ////
.................... //// or distribution is permitted without written permission. ////
.................... //// Derivative programs created using this software in object code ////
.................... //// form are not restricted in any way. ////
.................... ////////////////////////////////////////////////////////////////////////////
....................
.................... #ifndef _STRING
.................... #define _STRING
.................... #include <stddef.h>
.................... ///////////////////////////////////////////////////////////////////////////
.................... //// (C) Copyright 1996,2003 Custom Computer Services ////
.................... //// This source code may only be used by licensed users of the CCS C ////
.................... //// compiler. This source code may only be distributed to other ////
.................... //// licensed users of the CCS C compiler. No other use, reproduction ////
.................... //// or distribution is permitted without written permission. ////
.................... //// Derivative programs created using this software in object code ////
.................... //// form are not restricted in any way. ////
.................... ///////////////////////////////////////////////////////////////////////////
....................
.................... #ifndef _STDDEF
....................
.................... #define _STDDEF
....................
.................... #if sizeof(int *)==1
.................... #define ptrdiff_t int
.................... #else
.................... #define ptrdiff_t long
.................... #endif
....................
.................... #define size_t int
.................... #define wchar_t char
.................... #define NULL 0
....................
.................... #define offsetof(s,f) (offsetofbit(s,f)/8)
....................
.................... #endif
....................
.................... #include <ctype.h>
.................... ////////////////////////////////////////////////////////////////////////////
.................... //// (C) Copyright 1996,2003 Custom Computer Services ////
.................... //// This source code may only be used by licensed users of the CCS C ////
.................... //// compiler. This source code may only be distributed to other ////
.................... //// licensed users of the CCS C compiler. No other use, reproduction ////
.................... //// or distribution is permitted without written permission. ////
.................... //// Derivative programs created using this software in object code ////
.................... //// form are not restricted in any way. ////
.................... ////////////////////////////////////////////////////////////////////////////
....................
.................... #ifndef _CTYPE
.................... #define _CTYPE
....................
.................... #define islower(x) isamong(x,"abcdefghijklmnopqrstuvwxyz")
.................... #define isupper(x) isamong(x,"ABCDEFGHIJKLMNOPQRSTUVWXYZ")
.................... #define isalnum(x) isamong(x,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")
.................... #define isalpha(x) isamong(x,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")
.................... #define isdigit(x) isamong(x,"0123456789")
.................... #define isspace(x) (x==' ')
.................... #define isxdigit(x) isamong(x,"0123456789ABCDEFabcdef")
.................... #define iscntrl(x) (x<' ')
.................... #define isprint(x) (x>=' ')
.................... #define isgraph(x) (x>' ')
.................... #define ispunct(x) ((x>' ')&&!isalnum(x))
....................
.................... #endif
....................
....................
....................
....................
....................
.................... //////////////////////////////////////////////
.................... //// Uncomment the following define to ////
.................... //// allow some functions to use a ////
.................... //// quicker algorithm, but use more ROM ////
.................... //// ////
.................... //// #define FASTER_BUT_MORE_ROM ////
.................... //////////////////////////////////////////////
....................
....................
....................
.................... /*Copying functions*/
.................... /* standard template:
.................... void *memmove(void *s1, void *s2, size_t n).
.................... Copies max of n characters safely (not following ending '\0')
.................... from s2 in s1; if s2 has less than n characters, appends 0 */
....................
.................... char *memmove(void *s1,char *s2,size_t n)
.................... {
.................... char *sc1;
.................... char *sc2;
.................... sc1=s1;
.................... sc2=s2;
.................... if(sc2<sc1 && sc1 <sc2 +n)
.................... for(sc1+=n,sc2+=n;0<n;--n)
.................... *--sc1=*--sc2;
.................... else
.................... for(;0<n;--n)
.................... *sc1++=*sc2++;
.................... return s1;
.................... }
....................
.................... /* compiler ignored the name 'strcpy()'; perhaps, it's reserved?
.................... Standard template: char *strcpy(char *s1, const char *s2)
.................... copies the string s2 including the null character to s1*/
....................
.................... char *strcopy(char *s1, char *s2)
.................... {
.................... char *s;
....................
.................... for (s = s1; *s2 != 0; s++, s2++) {
.................... *s = *s2;
.................... }
.................... *s = *s2;
.................... return(s1);
.................... }
....................
.................... /* standard template:
.................... char *strncpy(char *s1, const char *s2, size_t n).
.................... Copies max of n characters (not following ending '\0')
.................... from s2 in s1; if s2 has less than n characters, appends 0 */
....................
.................... char *strncpy(char *s1, char *s2, size_t n)
.................... {
.................... char *s;
....................
.................... for (s = s1; n > 0 && *s2 != '\0'; n--)
.................... *s++ = *s2++;
.................... for (; n > 0; n--)
.................... *s++ = '\0';
....................
.................... return(s1);
.................... }
.................... /***********************************************************/
....................
.................... /*concatenation functions*/
.................... /* standard template: char *strcat(char *s1, const char *s2)
.................... appends s2 to s1*/
....................
.................... char *strcat(char *s1, char *s2)
.................... {
.................... char *s;
....................
.................... for (s = s1; *s != '\0'; ++s);
.................... while(*s2 != '\0')
.................... {
.................... *s = *s2;
.................... ++s;
.................... ++s2;
.................... }
....................
.................... *s = '\0';
.................... return(s1);
.................... }
.................... /* standard template: char *strncat(char *s1, char *s2,size_t n)
.................... appends not more than n characters from s2 to s1*/
....................
.................... char *strncat(char *s1, char *s2, size_t n)
.................... {
.................... char *s;
....................
.................... for (s = s1; *s != '\0'; ++s);
.................... while(*s2 != '\0' && 0<n)
.................... {
.................... *s = *s2;
.................... ++s;
.................... ++s2;
.................... --n;
.................... }
....................
.................... *s = '\0';
.................... return(s1);
.................... }
....................
.................... /***********************************************************/
....................
....................
.................... /*comparison functions*/
.................... /* standard template: signed int memcmp(void *s1, void *s2).
.................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */
....................
.................... signed int memcmp(void * s1,char *s2,size_t n)
.................... {
.................... char *su1, *su2;
.................... for(su1=s1, su2=s2; 0<n; ++su1, ++su2, --n)
.................... {
.................... if(*su1!=*su2)
.................... return ((*su1<*su2)?-1:+1);
.................... }
.................... return 0;
.................... }
....................
.................... /* standard template: int strcmp(const char *s1, const char *s2).
.................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */
....................
.................... signed int strcmp(char *s1, char *s2)
.................... {
.................... for (; *s1 == *s2; s1++, s2++)
.................... if (*s1 == '\0')
.................... return(0);
.................... return((*s1 < *s2) ? -1: 1);
.................... }
.................... /* standard template: int strcoll(const char *s1, const char *s2).
.................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */
....................
.................... signed int strcoll(char *s1, char *s2)
.................... {
.................... for (; *s1 == *s2; s1++, s2++)
.................... if (*s1 == '\0')
.................... return(0);
.................... return((*s1 < *s2) ? -1: 1);
.................... }
....................
.................... /* standard template:
.................... int strncmp(const char *s1, const char *s2, size_t n).
.................... Compares max of n characters (not following 0) from s1 to s2;
.................... returns same as strcmp */
....................
.................... signed int strncmp(char *s1, char *s2, size_t n)
.................... {
.................... for (; n > 0; s1++, s2++, n--)
.................... if (*s1 != *s2)
.................... return((*s1 <*s2) ? -1: 1);
.................... else if (*s1 == '\0')
.................... return(0);
.................... return(0);
.................... }
.................... /* standard template:
.................... int strxfrm(const char *s1, const char *s2, size_t n).
.................... transforms maximum of n characters from s2 and places them into s1*/
.................... size_t strxfrm(char *s1, char *s2, size_t n)
.................... {
.................... char *s;
.................... int n1;
.................... n1=n;
.................... for (s = s1; n > 0 && *s2 != '\0'; n--)
.................... *s++ = *s2++;
.................... for (; n > 0; n--)
.................... *s++ = '\0';
....................
.................... return(n1);
.................... }
....................
....................
....................
....................
....................
.................... /***********************************************************/
.................... /*Search functions*/
.................... /* standard template: void *memchr(const char *s, int c).
.................... Finds first occurrence of c in n characters of s */
....................
.................... char *memchr(void *s,int c,size_t n)
.................... {
.................... char uc;
.................... char *su;
.................... uc=c;
.................... for(su=s;0<n;++su,--n)
.................... if(*su==uc)
.................... return su;
.................... return NULL;
.................... }
....................
.................... /* standard template: char *strchr(const char *s, int c).
.................... Finds first occurrence of c in s */
....................
.................... char *strchr(char *s, int c)
.................... {
.................... for (; *s != c; s++)
.................... if (*s == '\0')
.................... return(0);
.................... return(s);
.................... }
.................... /* standard template:
.................... size_t strcspn(const char *s1, const char *s2).
.................... Computes length of max initial segment of s1 that
.................... consists entirely of characters NOT from s2*/
....................
.................... int *strcspn(char *s1, char *s2)
.................... {
.................... char *sc1, *sc2;
....................
.................... for (sc1 = s1; *sc1 != 0; sc1++)
.................... for (sc2 = s2; *sc2 != 0; sc2++)
.................... if (*sc1 == *sc2)
.................... return(sc1 - s1);
.................... return(sc1 - s1);
.................... }
.................... /* standard template:
.................... char *strpbrk(const char *s1, const char *s2).
.................... Locates first occurence of any character from s2 in s1;
.................... returns s1 if s2 is empty string */
....................
.................... char *strpbrk(char *s1, char *s2)
.................... {
.................... char *sc1, *sc2;
....................
.................... for (sc1 = s1; *sc1 != 0; sc1++)
.................... for (sc2 = s2; *sc2 != 0; sc2++)
.................... if (*sc1 == *sc2)
.................... return(sc1);
.................... return(0);
.................... }
....................
....................
.................... /* standard template: char *strrchr(const char *s, int c).
.................... Finds last occurrence of c in s */
....................
.................... char *strrchr(char *s, int c)
.................... {
.................... char *p;
....................
.................... for (p = 0; ; s++)
.................... {
.................... if (*s == c)
.................... p = s;
.................... if (*s == '\0')
.................... return(p);
.................... }
.................... }
.................... /* computes length of max initial segment of s1 consisting
.................... entirely of characters from s2 */
....................
.................... int *strspn(char *s1, char *s2)
.................... {
.................... char *sc1, *sc2;
....................
.................... for (sc1 = s1; *sc1 != 0; sc1++)
.................... for (sc2 = s2; ; sc2++)
.................... if (*sc2 == '\0')
.................... return(sc1 - s1);
.................... else if (*sc1 == *sc2)
.................... break;
.................... return(sc1 - s1);
.................... }
.................... /* standard template:
.................... char *strstr(const char *s1, const char *s2);
.................... Locates first occurence of character sequence s2 in s1;
.................... returns 0 if s2 is empty string
....................
.................... Uncomment #define FASTER_BUT_MORE_ROM at the top of the
.................... file to use the faster algorithm */
.................... char *strstr(char *s1, char *s2)
.................... {
.................... char *s, *t;
....................
.................... #ifdef FASTER_BUT_MORE_ROM
.................... if (*s2 == '\0')
.................... return(s1);
.................... #endif
....................
.................... while (*s1)
.................... {
.................... for(s = s1, t = s2; *t && (*s == *t); ++s, ++t);
....................
.................... if (*t == '\0')
.................... return s1;
.................... ++s1;
.................... #ifdef FASTER_BUT_MORE_ROM
.................... while(*s1 != '\0' && *s1 != *s2)
.................... ++s1;
.................... #endif
.................... }
.................... return 0;
.................... }
....................
.................... /* standard template: char *strtok(char *s1, const char *s2).
....................
.................... Finds next token in s1 delimited by a character from separator
.................... string s2 (which can be different from call to call). First call
.................... starts at beginning of s1 searching for first character NOT
.................... contained in s2; returns 0 if none is found.
.................... If one is found, it is the start of first token (return value).
.................... Function then searches from there for a character contained in s2.
.................... If none is found, current token extends to end of s1, and subsequent
.................... searches for a token will return 0. If one is found, it is
.................... overwritten by '\0', which terminates current token. Function saves
.................... pointer to following character from which next search will start.
.................... Each subsequent call, with 0 as first argument, starts searching
.................... from saved pointer */
....................
.................... char *strtok(char *s1, char *s2)
.................... {
.................... char *beg, *end;
.................... static char *save;
....................
.................... beg = (s1)? s1: save;
.................... beg += strspn(beg, s2);
.................... if (*beg == '\0')
.................... {
.................... *save = ' ';
.................... return(0);
.................... }
.................... end = strpbrk(beg, s2);
.................... if (*end != '\0')
.................... {
.................... *end = '\0';
.................... end++;
.................... }
.................... save = end;
.................... return(beg);
.................... }
....................
.................... /*****************************************************************/
.................... /*Miscellaneous functions*/
.................... /* standard template
.................... maps error number in errnum to an error message string
.................... Returns: Pointer to string
.................... */
.................... #ifdef _ERRNO
.................... char * strerror(int errnum)
.................... {
.................... char s[15];
.................... switch( errnum)
.................... {
.................... case 0:
.................... strcpy(s,"no errors");
.................... return s;
.................... case EDOM :
.................... strcpy(s,"domain error");
.................... return s;
.................... case ERANGE:
.................... strcpy(s,"range error");
.................... return s;
.................... }
.................... }
.................... #ENDIF
.................... /* standard template: size_t strlen(const char *s).
.................... Computes length of s1 (preceding terminating 0) */
....................
.................... int *strlen(char *s)
.................... {
.................... char *sc;
....................
.................... for (sc = s; *sc != 0; sc++);
.................... return(sc - s);
.................... }
....................
.................... /* standard template: size_t stricmp(const char *s1, const char *s2).
.................... Compares s1 to s2 ignoring case (upper vs. lower) */
....................
.................... signed int stricmp(char *s1, char *s2)
.................... {
.................... for(; *s1==*s2||(isalpha(*s1)&&isalpha(*s2)&&(*s1==*s2+32||*s2==*s1+32));
.................... s1++, s2++)
.................... if (*s1 == '\0')
.................... return(0);
.................... return((*s1 < *s2) ? -1: 1);
.................... }
....................
....................
.................... /* standard template: char *strlwr(char *s).
.................... Replaces uppercase letters by lowercase;
.................... returns pointer to new string s */
....................
.................... char *strlwr(char *s)
.................... {
.................... char *p;
....................
.................... for (p = s; *p != '\0'; p++)
.................... if (*p >= 'A' && *p <='Z')
.................... *p += 'a' - 'A';
.................... return(s);
.................... }
....................
....................
.................... /************************************************************/
....................
....................
.................... #endif
....................
....................
.................... div_t div(signed int numer,signed int denom)
.................... {
.................... div_t val;
.................... val.quot = numer / denom;
.................... val.rem = numer - (denom * val.quot);
.................... return (val);
.................... }
....................
.................... ldiv_t ldiv(signed long numer,signed long denom)
.................... {
.................... ldiv_t val;
.................... val.quot = numer / denom;
.................... val.rem = numer - (denom * val.quot);
.................... return (val);
.................... }
....................
.................... float atof(char * s)
.................... {
.................... float pow10 = 1.0;
.................... float result = 0.0;
.................... int sign = 0;
.................... char c;
.................... int ptr = 0;
....................
.................... c = s[ptr++];
....................
.................... if ((c>='0' && c<='9') || c=='+' || c=='-' || c=='.') {
.................... if(c == '-') {
.................... sign = 1;
.................... c = s[ptr++];
.................... }
.................... if(c == '+')
.................... c = s[ptr++];
....................
.................... while((c >= '0' && c <= '9')) {
.................... result = 10*result + c - '0';
.................... c = s[ptr++];
.................... }
....................
.................... if (c == '.') {
.................... c = s[ptr++];
.................... while((c >= '0' && c <= '9')) {
.................... pow10 = pow10*10;
.................... result += (c - '0')/pow10;
.................... c = s[ptr++];
.................... }
.................... }
....................
.................... }
....................
.................... if (sign == 1)
.................... result = -1*result;
.................... return(result);
.................... }
....................
.................... float atoe(char * s)
.................... {
.................... float pow10 = 1.0;
.................... float result = 0.0;
.................... int sign = 0;
.................... int expsign = 0;
.................... char c;
.................... int ptr = 0;
.................... int i;
.................... float exp = 1.0;
.................... int expcnt = 0;
....................
.................... c = s[ptr++];
....................
.................... if ((c>='0' && c<='9') || c=='+' || c=='-' || c=='.' || c=='E' || c=='e') {
.................... if(c == '-') {
.................... sign = 1;
.................... c = s[ptr++];
.................... }
.................... if(c == '+')
.................... c = s[ptr++];
....................
.................... while((c >= '0' && c <= '9')) {
.................... result = 10*result + c - '0';
.................... c = s[ptr++];
.................... }
....................
.................... if (c == '.') {
.................... c = s[ptr++];
.................... while((c >= '0' && c <= '9')) {
.................... pow10 = pow10*10;
.................... result += (c - '0')/pow10;
.................... c = s[ptr++];
.................... }
.................... }
....................
.................... // Handling the exponent
.................... if (c=='e' || c=='E') {
.................... c = s[ptr++];
....................
.................... if(c == '-') {
.................... expsign = 1;
.................... c = s[ptr++];
.................... }
.................... if(c == '+')
.................... c = s[ptr++];
....................
.................... while((c >= '0' && c <= '9')) {
.................... expcnt = 10*expcnt + c - '0';
.................... c = s[ptr++];
.................... }
....................
.................... for(i=0;i<expcnt;i++)
.................... exp*=10;
....................
.................... if(expsign==1)
.................... result/=exp;
.................... else
.................... result*=exp;
.................... }
.................... }
....................
.................... if (sign == 1)
.................... result = -1*result;
.................... return(result);
.................... }
....................
.................... signed int atoi(char *s)
.................... {
.................... signed int result;
.................... int sign, base, index;
.................... char c;
....................
.................... index = 0;
.................... sign = 0;
.................... base = 10;
.................... result = 0;
....................
.................... if (!s)
.................... return 0;
.................... // Omit all preceeding alpha characters
.................... c = s[index++];
....................
.................... // increase index if either positive or negative sign is detected
.................... if (c == '-')
.................... {
.................... sign = 1; // Set the sign to negative
.................... c = s[index++];
.................... }
.................... else if (c == '+')
.................... {
.................... c = s[index++];
.................... }
....................
.................... if (c >= '0' && c <= '9')
.................... {
....................
.................... // Check for hexa number
.................... if (c == '0' && (s[index] == 'x' || s[index] == 'X'))
.................... {
.................... base = 16;
.................... index++;
.................... c = s[index++];
.................... }
....................
.................... // The number is a decimal number
.................... if (base == 10)
.................... {
.................... while (c >= '0' && c <= '9')
.................... {
.................... result = 10*result + (c - '0');
.................... c = s[index++];
.................... }
.................... }
.................... else if (base == 16) // The number is a hexa number
.................... {
.................... c = toupper(c);
.................... while ( (c >= '0' && c <= '9') || (c >= 'A' && c<='F'))
.................... {
.................... if (c >= '0' && c <= '9')
.................... result = (result << 4) + (c - '0');
.................... else
.................... result = (result << 4) + (c - 'A' + 10);
....................
.................... c = s[index++];
.................... c = toupper(c);
.................... }
.................... }
.................... }
....................
.................... if (sign == 1 && base == 10)
.................... result = -result;
....................
.................... return(result);
.................... }
....................
.................... signed long atol(char *s)
.................... {
.................... signed long result;
.................... int sign, base, index;
.................... char c;
....................
.................... index = 0;
.................... sign = 0;
.................... base = 10;
.................... result = 0;
....................
.................... if (!s)
.................... return 0;
.................... c = s[index++];
....................
.................... // increase index if either positive or negative sign is detected
.................... if (c == '-')
.................... {
.................... sign = 1; // Set the sign to negative
.................... c = s[index++];
.................... }
.................... else if (c == '+')
.................... {
.................... c = s[index++];
.................... }
....................
.................... if (c >= '0' && c <= '9')
.................... {
.................... if (c == '0' && (s[index] == 'x' || s[index] == 'X'))
.................... {
.................... base = 16;
.................... index++;
.................... c = s[index++];
.................... }
....................
.................... // The number is a decimal number
.................... if (base == 10)
.................... {
.................... while (c >= '0' && c <= '9')
.................... {
.................... result = 10*result + (c - '0');
.................... c = s[index++];
.................... }
.................... }
.................... else if (base == 16) // The number is a hexa number
.................... {
.................... c = toupper(c);
.................... while ( (c >= '0' && c <= '9') || (c >= 'A' && c <='F'))
.................... {
.................... if (c >= '0' && c <= '9')
.................... result = (result << 4) + (c - '0');
.................... else
.................... result = (result << 4) + (c - 'A' + 10);
....................
.................... c = s[index++];c = toupper(c);
.................... }
.................... }
.................... }
....................
.................... if (base == 10 && sign == 1)
.................... result = -result;
....................
.................... return(result);
.................... }
....................
.................... /* A fast routine to multiply by 10
.................... */
.................... signed int32 mult_with10(int32 num)
.................... {
.................... return ( (num << 1) + (num << 3) );
.................... }
....................
.................... signed int32 atoi32(char *s)
.................... {
.................... signed int32 result;
.................... int sign, base, index;
.................... char c;
....................
.................... index = 0;
.................... sign = 0;
.................... base = 10;
.................... result = 0;
....................
.................... if (!s)
.................... return 0;
.................... c = s[index++];
....................
.................... // increase index if either positive or negative sign is detected
.................... if (c == '-')
.................... {
.................... sign = 1; // Set the sign to negative
.................... c = s[index++];
.................... }
.................... else if (c == '+')
.................... {
.................... c = s[index++];
.................... }
....................
.................... if (c >= '0' && c <= '9')
.................... {
.................... if (c == '0' && (s[index] == 'x' || s[index] == 'X'))
.................... {
.................... base = 16;
.................... index++;
.................... c = s[index++];
.................... }
....................
.................... // The number is a decimal number
.................... if (base == 10)
.................... {
.................... while (c >= '0' && c <= '9') {
.................... result = (result << 1) + (result << 3); // result *= 10;
.................... result += (c - '0');
.................... c = s[index++];
.................... }
.................... }
.................... else if (base == 16) // The number is a hexa number
.................... {
.................... c = toupper(c);
.................... while ((c >= '0' && c <= '9') || (c >= 'A' && c <='F'))
.................... {
.................... if (c >= '0' && c <= '9')
.................... result = (result << 4) + (c - '0');
.................... else
.................... result = (result << 4) + (c - 'A' + 10);
....................
.................... c = s[index++];c = toupper(c);
.................... }
.................... }
.................... }
....................
.................... if (base == 10 && sign == 1)
.................... result = -result;
....................
.................... return(result);
.................... }
....................
.................... char * itoa(signed int32 num, int8 base, char *s)
.................... {
.................... int32 temp=1;
.................... int8 i,sign=0,cnt=0;
.................... char c;
....................
.................... if(num<0) {
.................... sign=1; // Check for negative number
.................... num*=-1;
.................... }
....................
.................... while(temp>0) {
.................... temp=(num/base);
.................... s[cnt]=(num%base)+'0'; // Conversion
....................
.................... if(s[cnt]>0x39)
.................... s[cnt]+=0x7;
....................
.................... cnt++;
.................... num=temp;
.................... }
....................
.................... if(sign==1) {
.................... s[cnt]=0x2D; // Negative sign
.................... cnt++;
.................... }
....................
.................... for(i = 0;i<(int8)(cnt/2);i++) {
....................
.................... c=s[i];
.................... s[i]=s[cnt-i-1]; // Reverse the number
.................... s[cnt-i-1]=c;
.................... }
.................... s[cnt]='\0'; // End the string
.................... return s;
.................... }
....................
.................... float strtod(char *s,char *endptr) {
.................... float pow10 = 1.0;
.................... float result = 0.0;
.................... int sign = 0, point = 0;
.................... char c;
.................... int ptr = 0;
....................
.................... if (!s)
.................... return 0;
.................... c=s[ptr++];
....................
....................
.................... while((c>='0' && c<='9') || c=='+' || c=='-' || c=='.') {
.................... if(c == '-') {
.................... sign = 1;
.................... c = s[ptr++];
.................... }
....................
.................... while((c >= '0' && c <= '9') && point == 0) {
.................... result = 10*result + c - '0';
.................... c = s[ptr++];
.................... }
....................
.................... if (c == '.') {
.................... point = 1;
.................... c = s[ptr++];
.................... }
....................
.................... while((c >= '0' && c <= '9') && point == 1) {
.................... pow10 = pow10*10;
.................... result += (c - '0')/pow10;
.................... c = s[ptr++];
.................... }
....................
.................... if (c == '+') {
.................... c = s[ptr++];
.................... }
.................... }
....................
.................... if (sign == 1)
.................... result = -1*result;
.................... if(endptr)
.................... {
.................... if (ptr) {
.................... ptr--;
.................... *((char *)endptr)=s+ptr;
.................... }
.................... else
.................... *((char *)endptr)=s;
.................... }
....................
.................... return(result);
.................... }
....................
.................... long strtoul(char *s,char *endptr,signed int base)
.................... {
.................... char *sc,*s1,*sd;
.................... unsigned long x=0;
.................... char sign;
.................... char digits[]="0123456789abcdefghijklmnopqstuvwxyz";
.................... for(sc=s;isspace(*sc);++sc);
.................... sign=*sc=='-'||*sc=='+'?*sc++:'+';
.................... if(sign=='-')
.................... {
.................... if (endptr)
.................... {
.................... *((char *)endptr)=s;
.................... }
.................... return 0;
.................... }
....................
.................... if (base <0 || base ==1|| base >36) // invalid base
.................... {
.................... if (endptr)
.................... {
.................... *((char *)endptr)=s;
.................... }
.................... return 0;
.................... }
.................... else if (base)
.................... {
.................... if(base==16 && *sc =='0'&&(sc[1]=='x' || sc[1]=='X'))
.................... sc+=2;
.................... if(base==8 && *sc =='0')
.................... sc+=1;
.................... if(base==2 && *sc =='0'&&sc&#
_________________
Ringo Davis
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Feb 25, 2015 1:47 pm     Reply with quote

Your include file stddef.h is not needed. It's not used by your program.
But it fills up the .LST file and exceeds the amount of code that the forum
program can handle (it gets cut off). Delete #include stddef.h.

How to post an image on the CCS forum:
Use http://www.postimage.com or http://www.imageshack.com
or some other free image hosting service.
Upload your schematic to that website. Preferably a .JPG file or some
other commonly used image format.
Then post a link to your image here in the forum.


Quote:
Compiler Version 4.007

This is not a great version. I would only write very simple code with
this version. Then it may work for you. You are basically doing that now.

If you bought the compiler, you might consider asking CCS to upgrade
you to the last and best version of 4.xxx, which is 4.141. Maybe they
would do it for free if you ask them nicely, or maybe they could cut you
a deal. It's worth a try. 4.007 is early beta.
Ringo42



Joined: 07 May 2004
Posts: 263

View user's profile Send private message

PostPosted: Wed Feb 25, 2015 2:01 pm     Reply with quote

Here is the lst file without stdlib, hopefully that helps

Here is a PDF of the schematic
http://postimg.org/image/pwk8htn57/

I asked support about an upgrade, guess I'll see what they say.
Thanks



Code:
CCS PCH C Compiler, Version 4.007, 34836               25-Feb-15 14:58

               Filename: C:\Users\Hardware\Dropbox\21st century\Firmware\21_Rx_V3N_rssi_test.lst

               ROM used: 880 bytes (3%)
                         Largest free fragment is 31888
               RAM used: 9 (1%) at main() level
                         17 (1%) worst case
               Stack:    3 locations

*
0000:  GOTO   029A
.................... #include "18f452.h"
.................... //////// Standard Header file for the PIC18F452 device ////////////////
.................... #device PIC18F452
.................... #list
.................... 
.................... #fuses hs,WDT8,noprotect,put,nolvp
.................... #device adc=10
.................... #device HIGH_INTS=true
.................... //#device ADC=UNSIGNED
.................... #use delay(clock=20000000,restart_wdt)
*
00F4:  CLRF   FEA
00F6:  MOVLW  09
00F8:  MOVWF  FE9
00FA:  MOVF   FEF,W
00FC:  BZ    0120
00FE:  MOVLW  06
0100:  MOVWF  01
0102:  MOVLW  BF
0104:  MOVWF  00
0106:  CLRWDT
0108:  DECFSZ 00,F
010A:  BRA    0106
010C:  DECFSZ 01,F
010E:  BRA    0102
0110:  MOVLW  7A
0112:  MOVWF  00
0114:  DECFSZ 00,F
0116:  BRA    0114
0118:  BRA    011A
011A:  CLRWDT
011C:  DECFSZ FEF,F
011E:  BRA    00FE
0120:  RETLW  00
.................... //#include <stdlib.h>
.................... 
.................... #define LED1_PIN    PIN_B6
.................... #define LED2_PIN    PIN_B7
.................... #define TX_PIN      PIN_C6
.................... #define RX_PIN      PIN_C7
.................... #define Mux_sel     PIN_E2
.................... #define BAUD_RATE 19200
.................... 
.................... #use rs232(baud=BAUD_RATE,xmit=TX_PIN,rcv=RX_PIN,errors,bits=8,parity=N,restart_wdt)
.................... ///Macros
.................... #define LED1_ON output_high(LED1_PIN)
.................... #define LED2_ON output_high(LED2_PIN)
.................... #define LED1_OFF output_low(LED1_PIN)
.................... #define LED2_OFF output_low(LED2_PIN)
.................... 
.................... 
.................... void CheckRssi();
.................... void InitPic();
.................... 
.................... unsigned int RSSIcounter=0;
.................... 
.................... 
.................... void main()
.................... {
*
029A:  CLRF   FF8
029C:  BSF    FD0.7
029E:  CLRF   FEA
02A0:  CLRF   FE9
02A2:  MOVLW  40
02A4:  MOVWF  FAF
02A6:  MOVLW  A6
02A8:  MOVWF  FAC
02AA:  MOVLW  90
02AC:  MOVWF  FAB
02AE:  BSF    FC1.0
02B0:  BSF    FC1.1
02B2:  BSF    FC1.2
02B4:  BCF    FC1.3
02B6:  CLRF   05
02B8:  CLRF   06
....................    setup_wdt(WDT_ON);
02BA:  BSF    FD1.0
....................    setup_timer_0(RTCC_INTERNAL);
02BC:  MOVLW  80
02BE:  MOVWF  FD5
.................... 
....................     printf("ABC\r\n   >");
02C0:  CLRF   07
02C2:  MOVF   07,W
02C4:  RCALL  0004
02C6:  INCF   07,F
02C8:  MOVWF  00
02CA:  CLRWDT
02CC:  BTFSS  F9E.4
02CE:  BRA    02CA
02D0:  MOVWF  FAD
02D2:  MOVLW  05
02D4:  SUBWF  07,W
02D6:  BNZ   02C2
02D8:  MOVLW  03
02DA:  MOVWF  08
02DC:  MOVLW  20
02DE:  CLRWDT
02E0:  BTFSS  F9E.4
02E2:  BRA    02DE
02E4:  MOVWF  FAD
02E6:  DECFSZ 08,F
02E8:  BRA    02DC
02EA:  MOVLW  3E
02EC:  CLRWDT
02EE:  BTFSS  F9E.4
02F0:  BRA    02EC
02F2:  MOVWF  FAD
....................     
....................    InitPic();         
02F4:  BRA    00A8
....................     printf("\r\n\nMotherboard RX, firmware 3n   >\r\n");
02F6:  CLRF   07
02F8:  MOVF   07,W
02FA:  RCALL  001C
02FC:  INCF   07,F
02FE:  MOVWF  00
0300:  CLRWDT
0302:  BTFSS  F9E.4
0304:  BRA    0300
0306:  MOVWF  FAD
0308:  MOVLW  1E
030A:  SUBWF  07,W
030C:  BNZ   02F8
030E:  MOVLW  03
0310:  MOVWF  08
0312:  MOVLW  20
0314:  CLRWDT
0316:  BTFSS  F9E.4
0318:  BRA    0314
031A:  MOVWF  FAD
031C:  DECFSZ 08,F
031E:  BRA    0312
0320:  MOVLW  3E
0322:  CLRWDT
0324:  BTFSS  F9E.4
0326:  BRA    0322
0328:  MOVWF  FAD
032A:  MOVLW  0D
032C:  CLRWDT
032E:  BTFSS  F9E.4
0330:  BRA    032C
0332:  MOVWF  FAD
0334:  MOVLW  0A
0336:  CLRWDT
0338:  BTFSS  F9E.4
033A:  BRA    0336
033C:  MOVWF  FAD
....................     printf("Copyright 2015 Ringo Davis\r\n>"); 
033E:  CLRF   07
0340:  MOVF   07,W
0342:  RCALL  004E
0344:  INCF   07,F
0346:  MOVWF  00
0348:  CLRWDT
034A:  BTFSS  F9E.4
034C:  BRA    0348
034E:  MOVWF  FAD
0350:  MOVLW  1D
0352:  SUBWF  07,W
0354:  BNZ   0340
....................     
....................     set_adc_channel( 5 );
0356:  MOVLW  28
0358:  MOVWF  01
035A:  MOVF   FC2,W
035C:  ANDLW  C7
035E:  IORWF  01,W
0360:  MOVWF  FC2
....................     delay_ms(1);
0362:  MOVLW  01
0364:  MOVWF  09
0366:  RCALL  00F4
....................     while (1)
....................     {
....................         CheckRssi();
0368:  BRA    01BC
....................         restart_wdt();
036A:  CLRWDT
....................     }
036C:  BRA    0368
.................... }
.................... 
.................... void CheckRssi()
.................... {
036E:  SLEEP
....................     int channel;
....................     unsigned int RSSI=0;
*
01BC:  CLRF   08
....................     set_adc_channel( 5 );
01BE:  MOVLW  28
01C0:  MOVWF  01
01C2:  MOVF   FC2,W
01C4:  ANDLW  C7
01C6:  IORWF  01,W
01C8:  MOVWF  FC2
....................     delay_ms(1);
01CA:  MOVLW  01
01CC:  MOVWF  09
01CE:  RCALL  00F4
....................     RSSI = Read_ADC();
01D0:  BSF    FC2.2
01D2:  BTFSC  FC2.2
01D4:  BRA    01D2
01D6:  MOVFF  FC3,08
....................     delay_ms(100);
01DA:  MOVLW  64
01DC:  MOVWF  09
01DE:  RCALL  00F4
.................... //    printf("RSSI!!!!!!!!!!!! \r\n");
.................... 
....................     if(RSSI >100) // If radio is detected, but up counter a bunch
01E0:  MOVF   08,W
01E2:  SUBLW  64
01E4:  BC    01F0
....................    {
....................         RSSIcounter+=10;
01E6:  MOVLW  0A
01E8:  ADDWF  06,F
....................       output_high(PIN_E1);
01EA:  BCF    F96.1
01EC:  BSF    F8D.1
....................    }
....................    else
01EE:  BRA    01F8
....................    {
....................         RSSIcounter-=1;//else slowly count down to make sure radio is really off
01F0:  MOVLW  01
01F2:  SUBWF  06,F
....................       output_low(PIN_E1);
01F4:  BCF    F96.1
01F6:  BCF    F8D.1
....................    }
.................... //    printf("RSSI 2\r\n");
....................     if(RSSIcounter >244)
01F8:  MOVF   06,W
01FA:  SUBLW  F4
01FC:  BC    0202
....................         RSSIcounter=244;
01FE:  MOVLW  F4
0200:  MOVWF  06
....................     if(RSSIcounter <2)
0202:  MOVF   06,W
0204:  SUBLW  01
0206:  BNC   020C
....................         RSSIcounter=2;
0208:  MOVLW  02
020A:  MOVWF  06
.................... //    printf("RSSI 3 \r\n");
....................     
.................... 
....................         
....................     if(RSSIcounter > 30)//if the radio is seen a few times
020C:  MOVF   06,W
020E:  SUBLW  1E
0210:  BC    0218
....................     {
....................         //output_high(MUX_Sel);//radio     
....................       output_high(PIN_B2);         
0212:  BCF    F93.2
0214:  BSF    F8A.2
....................     }
....................     
....................     else
0216:  BRA    0220
....................     {
....................         output_low(MUX_sel);//usb
0218:  BCF    F96.2
021A:  BCF    F8D.2
....................       output_low(PIN_B2);
021C:  BCF    F93.2
021E:  BCF    F8A.2
....................     }
.................... 
.................... //    printf("RSSI 4 \r\n");
.................... 
....................     printf("RSSI= %u    RSSIcounter= %u \r\n",RSSI,RSSIcounter);
0220:  CLRF   09
0222:  MOVF   09,W
0224:  RCALL  007C
0226:  INCF   09,F
0228:  MOVWF  00
022A:  CLRWDT
022C:  BTFSS  F9E.4
022E:  BRA    022A
0230:  MOVWF  FAD
0232:  MOVLW  06
0234:  SUBWF  09,W
0236:  BNZ   0222
0238:  MOVFF  08,0C
023C:  MOVLW  1B
023E:  MOVWF  0D
0240:  RCALL  014A
0242:  MOVLW  04
0244:  MOVWF  0A
0246:  MOVLW  20
0248:  CLRWDT
024A:  BTFSS  F9E.4
024C:  BRA    0248
024E:  MOVWF  FAD
0250:  DECFSZ 0A,F
0252:  BRA    0246
0254:  MOVLW  08
0256:  MOVWF  0B
0258:  MOVF   0B,W
025A:  RCALL  007C
025C:  INCF   0B,F
025E:  MOVWF  00
0260:  CLRWDT
0262:  BTFSS  F9E.4
0264:  BRA    0260
0266:  MOVWF  FAD
0268:  MOVLW  15
026A:  SUBWF  0B,W
026C:  BNZ   0258
026E:  MOVFF  06,0C
0272:  MOVLW  1B
0274:  MOVWF  0D
0276:  RCALL  014A
0278:  MOVLW  20
027A:  CLRWDT
027C:  BTFSS  F9E.4
027E:  BRA    027A
0280:  MOVWF  FAD
0282:  MOVLW  0D
0284:  CLRWDT
0286:  BTFSS  F9E.4
0288:  BRA    0284
028A:  MOVWF  FAD
028C:  MOVLW  0A
028E:  CLRWDT
0290:  BTFSS  F9E.4
0292:  BRA    028E
0294:  MOVWF  FAD
....................         
.................... }
0296:  GOTO   036A (RETURN)
.................... 
.................... void InitPic()
.................... {
....................      short int dummy_variable;
....................      setup_adc_ports(All_ANALOG);
*
00A8:  BCF    FC1.0
00AA:  BCF    FC1.1
00AC:  BCF    FC1.2
00AE:  BCF    FC1.3
....................     setup_adc( ADC_CLOCK_DIV_32 );
00B0:  BCF    FC1.6
00B2:  BCF    FC2.6
00B4:  BSF    FC2.7
00B6:  BSF    FC1.7
00B8:  BSF    FC2.0
....................     setup_spi(FALSE);
00BA:  BCF    FC6.5
00BC:  BCF    F94.5
00BE:  BSF    F94.4
00C0:  BCF    F94.3
00C2:  MOVLW  00
00C4:  MOVWF  FC6
00C6:  MOVWF  FC7
....................     setup_psp(PSP_DISABLED);
00C8:  BCF    F96.4
....................     setup_timer_2(T2_DIV_BY_4,128,16);// 18.6 khz 0-512 int every 8ms //
00CA:  MOVLW  78
00CC:  IORLW  05
00CE:  MOVWF  FCA
00D0:  MOVLW  80
00D2:  MOVWF  FCB
....................     setup_timer_0(RTCC_Internal|RTCC_div_2);
00D4:  MOVWF  FD5
....................   
.................... //    enable_interrupts(INT_RDA);    // Serial Data Available IRQ
....................     enable_interrupts(INT_TIMER2); // Timer 2 Overflow
00D6:  BSF    F9D.1
.................... //    enable_interrupts(global);     // Enable IRQs
....................     
....................     dummy_variable = input(PIN_E0);
00D8:  BSF    F96.0
00DA:  BCF    07.0
00DC:  BTFSC  F84.0
00DE:  BSF    07.0
....................     output_low(PIN_E1);
00E0:  BCF    F96.1
00E2:  BCF    F8D.1
....................     output_low(PIN_B2);
00E4:  BCF    F93.2
00E6:  BCF    F8A.2
....................     output_low(PIN_E2);//mux_sel
00E8:  BCF    F96.2
00EA:  BCF    F8D.2
.................... 
....................     input(pin_a4);//RTS       
00EC:  BSF    F92.4
....................     port_b_pullups(false);
00EE:  BSF    FF1.7
.................... }
00F0:  GOTO   02F6 (RETURN)

Configuration Fuses:
   Word  1: 2200   HS NOOSCSEN
   Word  2: 070E   BROWNOUT WDT8 WDT BORV20 PUT
   Word  3: 0100   CCP2C1
   Word  4: 0081   STVREN NODEBUG NOLVP
   Word  5: C00F   NOPROTECT NOCPD NOCPB
   Word  6: E00F   NOWRT NOWRTD NOWRTB NOWRTC
   Word  7: 400F   NOEBTR NOEBTRB

_________________
Ringo Davis
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Feb 25, 2015 2:29 pm     Reply with quote

Quote:
I narrowed it down to the line
//output_high(MUX_Sel);//radio

Mux_sel (pin E2) goes to a jumper block. I don't know what jumpers
are installed there. But the first thing to do, would be to investigate
if there is some hardware effect of setting that pin high, such that it
locks up the PIC.

Do that test with a very simple program as shown below. When it runs,
do you see both printf messages, or just the first one ?
Code:

#include "18f452.h"
#fuses hs,NOWDT,noprotect,put,nolvp
#device adc=10
#use delay(clock=20000000)

#define TX_PIN      PIN_C6
#define RX_PIN      PIN_C7
#define BAUD_RATE 19200
#define Mux_sel     PIN_E2

#use rs232(baud=BAUD_RATE,xmit=TX_PIN,rcv=RX_PIN,errors,bits=8,parity=N,restart_wdt)

void main()
{
printf("Start\r\n");
output_high(MUX_Sel);
printf("Just set mux sel high \n\r");
   
while(TRUE);
}
 
Ringo42



Joined: 07 May 2004
Posts: 263

View user's profile Send private message

PostPosted: Wed Feb 25, 2015 2:41 pm     Reply with quote

I get nothing when I run that code. I added a couple lines and now I get the first print statement. The pin does go high though. I put an LED on it.
The jumper block just sends the signal to the mux.

Code:
#include "18f452.h"
#fuses hs,NOWDT,noprotect,put,nolvp
#device adc=10
#use delay(clock=20000000)

#define TX_PIN      PIN_C6
#define RX_PIN      PIN_C7
#define BAUD_RATE 19200
#define Mux_sel     PIN_E2

#use rs232(baud=BAUD_RATE,xmit=TX_PIN,rcv=RX_PIN,errors,bits=8,parity=N,restart_wdt)

void main()
{
printf("Start\r\n");
delay_ms(1000);
output_low(MUX_Sel);
printf("Just set mux sel low \n\r");
delay_ms(1000);
output_high(MUX_Sel);
printf("Just set mux sel high \n\r");
   
while(TRUE);
}

_________________
Ringo Davis
Ringo42



Joined: 07 May 2004
Posts: 263

View user's profile Send private message

PostPosted: Wed Feb 25, 2015 2:56 pm     Reply with quote

Something is gotta be wrong here. I changed the pin to one that goes nowhere and it doesn't run. Then I did not use a pin at all.
Code:
#include "18f452.h"
#fuses hs,NOWDT,noprotect,put,nolvp
#device adc=10
#use delay(clock=20000000)

#define TX_PIN      PIN_C6
#define RX_PIN      PIN_C7
#define BAUD_RATE 19200
#define Mux_sel     PIN_E2
#define Mux_sel2     PIN_D4

#use rs232(baud=BAUD_RATE,xmit=TX_PIN,rcv=RX_PIN,errors,bits=8,parity=N,restart_wdt)

void main()
{
printf("Start\r\n");
delay_ms(1000);
//output_low(MUX_Sel2);
printf("Just set mux sel low \n\r");
delay_ms(1000);
//output_high(MUX_Sel2);
printf("Just set mux sel high \n\r");
   
while(TRUE);
}


and this does not run. I reload my last hex file from my previous test and it runs. How can this simple code be broken?

Code:
CCS PCH C Compiler, Version 4.007, 34836               25-Feb-15 15:53

               Filename: C:\Users\Hardware\Dropbox\21st century\Firmware\e2test.lst

               ROM used: 282 bytes (1%)
                         Largest free fragment is 32486
               RAM used: 7 (0%) at main() level
                         8 (1%) worst case
               Stack:    1 locations

*
0000:  GOTO   0094
.................... #include "18f452.h" 
.................... //////// Standard Header file for the PIC18F452 device ////////////////
.................... #device PIC18F452
.................... #list
.................... 
.................... #fuses hs,NOWDT,noprotect,put,nolvp 
.................... #device adc=10 
.................... #use delay(clock=20000000) 
006E:  CLRF   FEA
0070:  MOVLW  07
0072:  MOVWF  FE9
0074:  MOVF   FEF,W
0076:  BZ    0092
0078:  MOVLW  06
007A:  MOVWF  01
007C:  CLRF   00
007E:  DECFSZ 00,F
0080:  BRA    007E
0082:  DECFSZ 01,F
0084:  BRA    007C
0086:  MOVLW  7B
0088:  MOVWF  00
008A:  DECFSZ 00,F
008C:  BRA    008A
008E:  DECFSZ FEF,F
0090:  BRA    0078
0092:  RETLW  00
.................... 
.................... #define TX_PIN      PIN_C6 
.................... #define RX_PIN      PIN_C7 
.................... #define BAUD_RATE 19200 
.................... #define Mux_sel     PIN_E2 
.................... #define Mux_sel2     PIN_D4 
.................... 
.................... #use rs232(baud=BAUD_RATE,xmit=TX_PIN,rcv=RX_PIN,errors,bits=8,parity=N,restart_wdt) 
.................... 
.................... void main() 
.................... { 
0094:  CLRF   FF8
0096:  BCF    FD0.7
0098:  CLRF   FEA
009A:  CLRF   FE9
009C:  MOVLW  40
009E:  MOVWF  FAF
00A0:  MOVLW  A6
00A2:  MOVWF  FAC
00A4:  MOVLW  90
00A6:  MOVWF  FAB
00A8:  BSF    FC1.0
00AA:  BSF    FC1.1
00AC:  BSF    FC1.2
00AE:  BCF    FC1.3
00B0:  CLRF   05
.................... printf("Start\r\n");
00B2:  CLRF   06
00B4:  MOVF   06,W
00B6:  RCALL  0004
00B8:  INCF   06,F
00BA:  MOVWF  00
00BC:  CLRWDT
00BE:  BTFSS  F9E.4
00C0:  BRA    00BC
00C2:  MOVWF  FAD
00C4:  MOVLW  07
00C6:  SUBWF  06,W
00C8:  BNZ   00B4
.................... delay_ms(1000);
00CA:  MOVLW  04
00CC:  MOVWF  06
00CE:  MOVLW  FA
00D0:  MOVWF  07
00D2:  RCALL  006E
00D4:  DECFSZ 06,F
00D6:  BRA    00CE
.................... //output_low(MUX_Sel2); 
.................... printf("Just set mux sel low \n\r"); 
00D8:  CLRF   06
00DA:  MOVF   06,W
00DC:  RCALL  001C
00DE:  INCF   06,F
00E0:  MOVWF  00
00E2:  CLRWDT
00E4:  BTFSS  F9E.4
00E6:  BRA    00E2
00E8:  MOVWF  FAD
00EA:  MOVLW  17
00EC:  SUBWF  06,W
00EE:  BNZ   00DA
.................... delay_ms(1000);
00F0:  MOVLW  04
00F2:  MOVWF  06
00F4:  MOVLW  FA
00F6:  MOVWF  07
00F8:  RCALL  006E
00FA:  DECFSZ 06,F
00FC:  BRA    00F4
.................... //output_high(MUX_Sel2); 
.................... printf("Just set mux sel high \n\r"); 
00FE:  CLRF   06
0100:  MOVF   06,W
0102:  RCALL  0044
0104:  INCF   06,F
0106:  MOVWF  00
0108:  CLRWDT
010A:  BTFSS  F9E.4
010C:  BRA    0108
010E:  MOVWF  FAD
0110:  MOVLW  18
0112:  SUBWF  06,W
0114:  BNZ   0100
....................     
.................... while(TRUE); 
0116:  BRA    0116
.................... } 
0118:  SLEEP

Configuration Fuses:
   Word  1: 2200   HS NOOSCSEN
   Word  2: 0E0E   BROWNOUT WDT128 NOWDT BORV20 PUT
   Word  3: 0100   CCP2C1
   Word  4: 0081   STVREN NODEBUG NOLVP
   Word  5: C00F   NOPROTECT NOCPD NOCPB
   Word  6: E00F   NOWRT NOWRTD NOWRTB NOWRTC
   Word  7: 400F   NOEBTR NOEBTRB

_________________
Ringo Davis
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Feb 25, 2015 3:14 pm     Reply with quote

Here's an old post from 2008 where you say delay_ms() doesn't work
correctly with vs. 4.007.
http://www.ccsinfo.com/forum/viewtopic.php?t=36003
temtronic



Joined: 01 Jul 2010
Posts: 9229
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Feb 25, 2015 3:20 pm     Reply with quote

couple of 'issues'..

The schematic show a PIC16F877 but code shows 18F452......

which is the real PIC ?


The RSSI PWM output will only ever get to about 3 volts,about 2/3 of the 877 ADC range....

Jay
Ringo42



Joined: 07 May 2004
Posts: 263

View user's profile Send private message

PostPosted: Wed Feb 25, 2015 3:26 pm     Reply with quote

Google found the old post. Damn my bad memory. I don't remember that issue at all, but it has been a long time since I worked on this.

Yes it really is a 452. I'm not concerned about the 2/3 range stuff.
I'll fix the delay_ms and see if that does it.
Thanks PCMP
_________________
Ringo Davis
Ringo42



Joined: 07 May 2004
Posts: 263

View user's profile Send private message

PostPosted: Wed Feb 25, 2015 3:36 pm     Reply with quote

well it is not the delay.
This does not run either

Code:
#include "18f452.h"
#fuses hs,NOWDT,noprotect,put,nolvp
#device adc=10
#use delay(clock=20000000)

#define TX_PIN      PIN_C6
#define RX_PIN      PIN_C7
#define BAUD_RATE 19200
#define Mux_sel     PIN_E2
#define Mux_sel2     PIN_D4

#use rs232(baud=BAUD_RATE,xmit=TX_PIN,rcv=RX_PIN,errors,bits=8,parity=N,restart_wdt)

void main()
{
printf("Start\r\n");
//output_low(MUX_Sel2);
printf("Just set mux sel low \n\r");
//output_high(MUX_Sel2);
printf("Just set mux sel high \n\r");
   
while(TRUE);
}

_________________
Ringo Davis
Ringo42



Joined: 07 May 2004
Posts: 263

View user's profile Send private message

PostPosted: Wed Feb 25, 2015 3:45 pm     Reply with quote

oops here is the lst
Code:
CCS PCH C Compiler, Version 4.007, 34836               25-Feb-15 16:33

               Filename: C:\Users\Hardware\Dropbox\21st century\Firmware\e2test.lst

               ROM used: 216 bytes (1%)
                         Largest free fragment is 32552
               RAM used: 7 (0%) at main() level
                         7 (0%) worst case
               Stack:    1 locations

*
0000:  GOTO   006E
.................... #include "18f452.h" 
.................... //////// Standard Header file for the PIC18F452 device ////////////////
.................... #device PIC18F452
.................... #list
.................... 
.................... #fuses hs,NOWDT,noprotect,put,nolvp 
.................... #device adc=10 
.................... #use delay(clock=20000000) 
.................... 
.................... #define TX_PIN      PIN_C6 
.................... #define RX_PIN      PIN_C7 
.................... #define BAUD_RATE 19200 
.................... #define Mux_sel     PIN_E2 
.................... #define Mux_sel2     PIN_D4 
.................... 
.................... #use rs232(baud=BAUD_RATE,xmit=TX_PIN,rcv=RX_PIN,errors,bits=8,parity=N,restart_wdt) 
.................... 
.................... void main() 
.................... { 
006E:  CLRF   FF8
0070:  BCF    FD0.7
0072:  CLRF   FEA
0074:  CLRF   FE9
0076:  MOVLW  40
0078:  MOVWF  FAF
007A:  MOVLW  A6
007C:  MOVWF  FAC
007E:  MOVLW  90
0080:  MOVWF  FAB
0082:  BSF    FC1.0
0084:  BSF    FC1.1
0086:  BSF    FC1.2
0088:  BCF    FC1.3
008A:  CLRF   05
.................... printf("Start\r\n");
008C:  CLRF   06
008E:  MOVF   06,W
0090:  RCALL  0004
0092:  INCF   06,F
0094:  MOVWF  00
0096:  CLRWDT
0098:  BTFSS  F9E.4
009A:  BRA    0096
009C:  MOVWF  FAD
009E:  MOVLW  07
00A0:  SUBWF  06,W
00A2:  BNZ   008E
.................... //output_low(MUX_Sel2); 
.................... printf("Just set mux sel low \n\r"); 
00A4:  CLRF   06
00A6:  MOVF   06,W
00A8:  RCALL  001C
00AA:  INCF   06,F
00AC:  MOVWF  00
00AE:  CLRWDT
00B0:  BTFSS  F9E.4
00B2:  BRA    00AE
00B4:  MOVWF  FAD
00B6:  MOVLW  17
00B8:  SUBWF  06,W
00BA:  BNZ   00A6
.................... //output_high(MUX_Sel2); 
.................... printf("Just set mux sel high \n\r"); 
00BC:  CLRF   06
00BE:  MOVF   06,W
00C0:  RCALL  0044
00C2:  INCF   06,F
00C4:  MOVWF  00
00C6:  CLRWDT
00C8:  BTFSS  F9E.4
00CA:  BRA    00C6
00CC:  MOVWF  FAD
00CE:  MOVLW  18
00D0:  SUBWF  06,W
00D2:  BNZ   00BE
....................     
.................... while(TRUE); 
00D4:  BRA    00D4
.................... } 
00D6:  SLEEP

Configuration Fuses:
   Word  1: 2200   HS NOOSCSEN
   Word  2: 0E0E   BROWNOUT WDT128 NOWDT BORV20 PUT
   Word  3: 0100   CCP2C1
   Word  4: 0081   STVREN NODEBUG NOLVP
   Word  5: C00F   NOPROTECT NOCPD NOCPB
   Word  6: E00F   NOWRT NOWRTD NOWRTB NOWRTC
   Word  7: 400F   NOEBTR NOEBTRB

_________________
Ringo Davis
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Feb 25, 2015 3:51 pm     Reply with quote

I installed PCH vs. 4.007 and compiled your program above, and I ran it
on a PicDem2-Plus (old version) and it basically worked:
Code:
ÓÓStart
Just set mux sel low
Just set mux sel high

I got a couple garbage characters before the start, but it displayed all
messages in TeraTerm.

I think you're using an LVP programmer. Can you do a Verify and check
if the code was written to the PIC properly ?
Ringo42



Joined: 07 May 2004
Posts: 263

View user's profile Send private message

PostPosted: Wed Feb 25, 2015 3:53 pm     Reply with quote

I'm using an ICD-U64. I just did a verify and it passed.
_________________
Ringo Davis
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
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