Balderbraa
Member
Greetings!
Im currently working on a serial port sniffer/logger and have run into some things i dont quite understand.
Im using a 28x2 module (AXE200) with a 24LC128 eeprom and 4,7K pullup soldered to the underside of the module.
The main idea is to background recieve one series of data bytes @N4800 (max 1024bytes) and on my command transfer
these to the eeprom from scratchpad so i can transfer the values to the computer later. The data stream is
controlled by me and is only sendt once (So i guess the scratchpad never overflows if i reset the chip before making the transfer).
My setup is this:
Please note that the S1-1 to S1-4 is not implemented yet and the eeprom header is unused.
Then over to the actual programming:
Im not sure that i correctly understand the use of the pointers ptr, @ptr princ...etc.
This code usally just gives out a bunch of $00 and $80 into the terminal (1024 in total) and not the bytes
i was sending to the picaxe.
Does anyone have a opinion of how i can make this thing work as i intend?
Im currently working on a serial port sniffer/logger and have run into some things i dont quite understand.
Im using a 28x2 module (AXE200) with a 24LC128 eeprom and 4,7K pullup soldered to the underside of the module.
The main idea is to background recieve one series of data bytes @N4800 (max 1024bytes) and on my command transfer
these to the eeprom from scratchpad so i can transfer the values to the computer later. The data stream is
controlled by me and is only sendt once (So i guess the scratchpad never overflows if i reset the chip before making the transfer).
My setup is this:
Please note that the S1-1 to S1-4 is not implemented yet and the eeprom header is unused.
Then over to the actual programming:
Im not sure that i correctly understand the use of the pointers ptr, @ptr princ...etc.
Code:
; *************************************
; ******** Sample Header File ********
; *************************************
; Filename:Serial sniffer.bas
; Date:11.06.2013
; File Version:B
; Written by: Bendik Henriksen
; Function:
; Last Revision:
; Target PICAXE: 28X2
; *************************************
#PicAxe 28X2
#Slot 0
Setfreq em32
Symbol SW1=pinA.2
Symbol SW2=pinA.1
Symbol RDY_LED=C.0
Symbol ERR_LED=C.1
Symbol END_LED=C.2
High RDY_LED
Do while SW1=0 ;Wait for button press to continue program
;,and set up background recieve
loop
Low RDY_LED
Hsersetup B4800_32,%00111 ;Set-up for background recieve
HI2CSETUP I2CMASTER,%10100000,i2cfast_32,i2cword ;Set-up for eeprom
Main:
if SW2=1 then copy_to_eeprom ;Here it should just wait and let the background
;recieve do its work.
Goto Main
Copy_to_eeprom:
ptr=0
low RDY_LED
for b0=0 to 15 ;This is the bit where i get confused. Is it
;wrong to use the pointers this way, or do i
;have to put the values in variables first and if
;so, how can i put it into eeprom as fast as possible?
writei2c 0,(@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc)
pause 40
next b0
ptr=0
high RDY_LED
Wait_for_it:
Do while SW1=0 ;Do nothing while connecting the hserout to the computer
;Move on when i press SW1 to display data in terminal.
loop
Transfer_to_terminal:
Low RDY_LED
for W1=0 to 1023
readi2c W1,(B1)
pause 40
hserout 0,(B1)
next W1
High RDY_LED
High END_LED
end
i was sending to the picaxe.
Does anyone have a opinion of how i can make this thing work as i intend?