Help to setup GPS connection.


Closed Thread
Results 1 to 34 of 34

Hybrid View

  1. #1
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    You are right, a word only goes up to 65535. If you have PBP v 2.5 or later, (and were using a PIC18 chip) you could select to use PBPL to compile, and define your large variables as LONG instead of WORD.

    If you want to stick with the PIC16 series, you could use N-BIT math. http://www.picbasic.co.uk/forum/cont...153-N-Bit_MATH

    By the way, it looks like you are using PM as your assembler.
    Code:
    @ DEVICE HS_OSC
    You probably need to use MPASM for N-Bit Math to work. For that, you define your configs like this:
    Code:
    @ __config _HS_OSC & _WDT_OFF & _LVP_OFF & _CP_OFF
    But you must comment out the configs in you C:/PBP/16F877A.INC file.

    See : http://www.picbasic.co.uk/forum/cont...o-your-Program
    Last edited by ScaleRobotics; - 7th November 2010 at 15:41.
    http://www.scalerobotics.com

  2. #2
    Join Date
    Oct 2008
    Posts
    65


    Did you find this post helpful? Yes | No

    Default

    Hi scalerobotics, I got my setup using Mpasm, and trying to figure out how Darrel's N-Bit_Math works, I need a sample to study its output. Try to use wozzy's code in pic16f877A
    Code:
    PRECISION CON 8 SYSTEM  	' 8 bytes = 64-bit   
    INCLUDE "N-Bit_Math.pbp"	' Include Alexander Avtanski's Multibyte Arithmetic 
    				' Assembly Library Wrapped for PBP by Darryl Taylor
    				' Version:1.3 Beta (1/7/2010)
    ;@ DEVICE HS_OSC
    @ __config _HS_OSC & _WDT_OFF & _LVP_OFF & _CP_OFF
    DEFINE OSC 20			' 20 MHz Crystal Oscillator
    
    DEFINE DEBUG_REG PORTC		' PORT C6
    DEFINE DEBUG_BIT 6 			' PORT C6
    DEFINE DEBUG_BAUD 57600		' BAUD 57600
    DEFINE DEBUG_MODE 0 		' 1 = inverted, 0 = true
    
    
    I			VAR	BYTE
    
    AA64 		VAR BYTE[PRECISION]
    BB64		VAR BYTE[PRECISION]
    CC64     	VAR BYTE[PRECISION]
    DD64		VAR BYTE[PRECISION]
    
    XX64		VAR BYTE[PRECISION]
    YY64		VAR BYTE[PRECISION]
    ZZ64		VAR BYTE[PRECISION]
    
    PAUSE 500 : DEBUG "   ",10,13,10,13 : PAUSE 500
    
    MAIN:
    	
    	
    	@  MATH_MUL  _AA64, _BB64, _XX64	; @  MATH_MUL  _A, _B, _Res ; Res = A / B - Remainder in REG_Z
    	@  MATH_DIV  _CC64, _DD64, _YY64	; @  MATH_DIV  _A, _B, _Res ; Res = A / B - Remainder in REG_Z
    	@  MATH_DIV  _DD64, _CC64, _ZZ64	; @  MATH_DIV  _A, _B, _Res ; Res = A / B - Remainder in REG_Z
    	
    	DEBUG "BYTE ORDER BYTE[7],BYTE[6],BYTE[5],BYTE[4],BYTE[3],BYTE[2],BYTE[1],BYTE[0]",10,13,10,13
    	DEBUG "AA64 = " : FOR I = 7 to 0 Step -1 : DEBUG BIN8 AA64[I] : NEXT I : DEBUG 10,13
    	DEBUG "BB64 = " : FOR I = 7 to 0 Step -1 : DEBUG BIN8 BB64[I] : NEXT I : DEBUG 10,13
    	DEBUG "CC64 = " : FOR I = 7 to 0 Step -1 : DEBUG BIN8 CC64[I] : NEXT I : DEBUG 10,13
    	DEBUG "DD64 = " : FOR I = 7 to 0 Step -1 : DEBUG BIN8 DD64[I] : NEXT I : DEBUG 10,13
    	DEBUG "XX64 = " : FOR I = 7 to 0 Step -1 : DEBUG BIN8 XX64[I] : NEXT I : DEBUG 10,13
    	DEBUG "YY64 = " : FOR I = 7 to 0 Step -1 : DEBUG BIN8 YY64[I] : NEXT I : DEBUG 10,13
    	DEBUG "ZZ64 = " : FOR I = 7 to 0 Step -1 : DEBUG BIN8 ZZ64[I] : NEXT I : DEBUG 10,13
    	DEBUG "REG_Z = " : FOR I = 7 to 0 Step -1 : DEBUG BIN8 REG_Z[I] : NEXT I : DEBUG 10,13
    	DEBUG 10,13,10,13,10,13,10,13
    	PAUSE 10000
    GOTO MAIN
    
    END
    I don't have any display on the hyper terminal window, My first time to encounter DEBUG command, but I think its similar to Serout2, is not it?

    regards,
    mbox

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts