Jump to content

soyuz

Members
  • Content Count

    1
  • Joined

  • Last visited

Community Reputation

0 Neutral

About soyuz

  • Rank
    Newbrie
  1. Hi there, I am new to Basic PIC programming and I have some issues obtaining a .hex file from a .bas file I can compile the .bas file by clicking the C button on the Sourceboost toolbar... however when I try to link or build the project I obtain errors that tell me: Linking... "C:\Program Files\SourceBoost\boostlink.pic.exe" /ld "C:\Program Files\SourceBoost\lib" libc.pic16.lib _.obj /t PIC16F628 /d "C:\Documents and Settings\florin_new\Local Settings\Temp" /p adc BoostLink Optimizing Linker Version 6.70 http://www.sourceboost.com Copyright© 2004-2007 Pavel Baranov Copyright© 2004-2007 David Hobday failure Couldn't find function/label by name:main Done I guess at this point my question is... given a .bas file... how do I obtain the .hex file? I included bellow my .bas file. Thank you, Soyuz ==================================== @define pic16F628, intrc_osc_noclkout,wdt_off,pwrt_on,mclr_off,bod_off,lvp_off,protect_off DEFINE DEBUG_REG PORTB DEFINE DEBUG_BIT 4 ' Serial output pin is RB4 DEFINE DEBUG_BAUD 9600 DEFINE DEBUG_MODE 1 ' Standard serial output DEFINE DEBUG_PACING 1000 ' 1ms pause between characters DEFINE OSC 4 INCLUDE "modedefs.bas" ' *** Pin assignments *** ADC_SCLK var PORTB.1 ' adc serial clock ADC_CS var PORTB.2 ' adc chip select ADC_DATA var PORTB.3 ' adc serial data EEPROM_SCLK var PORTA.0 ' eeprom serial clock pin EEPROM_DATA var PORTA.1 ' eeprom serial data pin MAIN var PORTB.5 ' main chute deployment pin SWITCH1 var PORTA.3 ' stand-by mode SWITCH3 var PORTA.5 ' transmit data G_SWITCH var PORTA.4 ' launch detect RED_LED var PORTB.0 ' pin used for the red LED GREEN_LED var PORTA.2 ' pin used for the green LED ' *** Variable definitions *** adc_value var word ' value read from adc int_address var word ' internal eeprom address ext_address var word ' external eeprom address eepromdata var byte ' data byte to be sent to or read from eeprom i var word ' general purpose loop counter total var word prev_total var word ' *** Constant definitions *** EEPROM_READ con %10100001 ' Control codes for external EEPROM_WRITE con %10100000 ' I2C eeprom R/W operations THRESHOLD con 32000 low MAIN 'outputs to MAIN ignitor set to low CMCON = 7 ' set comparators to digital I/O ports T1CON = 0 ' ******************************************************************************** ************** ' {main} ' turn ON both LEDs (green and red) high RED_LED high GREEN_LED check_switch_status: if SWITCH3=0 then transmit_data if SWITCH1=0 then check_switch_status 'green led off; red constant low GREEN_LED for i=1 to 30 low RED_LED pause 250 high RED_LED pause 250 next i ' *** Read and store ground level data prior to launch in internal eeprom int_address = 0 for i=1 to 16 gosub Read_ADC gosub Store_Ground_Data next i wait_for_launch: if G_SWITCH=0 AND SWITCH1=1 AND SWITCH3=1 then lift_off if SWITCH1=0 or SWITCH3=0 then check_switch_status goto wait_for_launch ' *** LIFT-OFF!!! *** lift_off: ext_address = 0 prev_total = 40000 Flight_part2: gosub Read_Flight_Data if total > THRESHOLD then ' *** TIMER START SIGNAL*** high MAIN ' *** TIMER START SIGNAL *** eepromdata=$FF gosub Write_EEPROM gosub Write_EEPROM goto Flight_part3 else goto Flight_part2 endif Flight_part3: while ext_address < 32767 gosub Read_Flight_Data wend low RED_LED end ' external eeprom is full; shutdown. ' ******************************************************************************** ************** ' * Send data out serial port * ' ******************************************************************************** ************** transmit_data: high GREEN_LED low RED_LED ' *** ground level data int_address = 0 for i = 1 to 16 read int_address, adc_value.highbyte int_address = int_address + 1 read int_address, adc_value.lowbyte int_address = int_address + 1 debug dec adc_value, 13 next i debug 13 ' *** flight data ext_address = 0 for i=1 to 16384 gosub Read_EEPROM adc_value.highbyte = eepromdata ext_address = ext_address + 1 gosub Read_EEPROM adc_value.lowbyte = eepromdata ext_address = ext_address + 1 debug dec adc_value, 13 toggle GREEN_LED next i low GREEN_LED end ' eeprom data is downloaded; shutdown. ' ******************************************************************************** ************** ' * SUBROUTINES * ' ******************************************************************************** ************** Read_Flight_Data: toggle RED_LED total = 0 for i=1 to 8 gosub Read_ADC total = total + adc_value eepromdata = adc_value.highbyte gosub Write_EEPROM eepromdata = adc_value.lowbyte gosub Write_EEPROM pauseus 1314 next i return Store_Ground_Data: write int_address, adc_value.highbyte int_address = int_address + 1 write int_address, adc_value.lowbyte int_address = int_address + 1 return Read_ADC: low ADC_CS shiftin ADC_DATA,ADC_SCLK,msbpost,[adc_value\12] high ADC_CS return Write_EEPROM: i2cwrite EEPROM_DATA, EEPROM_SCLK, EEPROM_WRITE, ext_address, [eepromdata] ext_address = ext_address + 1 pause 5 return Read_EEPROM: i2cread EEPROM_DATA, EEPROM_SCLK, EEPROM_READ, ext_address, [eepromdata] pause 5 return ' ******************************************************************************** **************
×
×
  • Create New...