Of course not! You would see the ASCII representation of 12. Andy K. PS: I wrote this routine! On Sun, 23 Apr 2000 23:31:54 +0200 Saurabh Sinha writes: > Hi, > > I have been trying to use this code to transfer bits to the PC. I > have a > problem, if i try and send (write say '12' to txreg, then I don't > receive > the number 12)...Could someone please help! > > Thanks in advance for your help. > > Regards, > > Saurabh > > ========================================================================= = > list p=16f84 > __config 3ff5 > > ;port definitions > porta equ 05 > portb equ 06 > > ;pin definitions > ;PORTB > cwpin equ 1 ;the audio cw pin(output) > keypin equ 2 ;the ptt pin(output) > > ;PORTA > serotp equ 1 ;the serial out pin(output) > serinp equ 0 ;the serial in pin(input!) > > ;mem definitions > w equ 00 ;W reg > f equ 01 ;F reg > > indf equ 00 ;indf (not physical) > fsr equ 04 ;fsr > > status equ 03 ;status reg > optreg equ 81 ;option register > > mils equ 10 ;where the time delay is > stored > mins equ 20 ;where the mindelay counter > is > stored > qtrs equ 21 ;where the qtrdelay counter > is > stored > > dlyset equ 22 ;where the inter-msg delay > is stored > keydel equ 23 ;where the keyup delay is > stored > > dahlen equ 24 ;where the dah length is > stored > ditlen equ 25 ;where the dit length is > stored > > mempos equ 26 ;where the EE pos is stored > dat equ 27 ;where the EE dat is stored > > txreg equ 28 ;where the dat to be > serially txed > is > rxreg equ 29 ;where the serially recd dat > is > > ;eedata defs > eedata equ 08 ;dat in/out of ee > eeadr equ 09 ;eeadr control reg > eecon1 equ 88 ;eecon1 control reg > eecon2 equ 89 ;eecon2 control reg(wr > only!) > > ;refs > dahl equ 00 ;pos of dahlen > ditl equ 01 ;pos of ditlen > idly equ 02 ;pos of idle delay > keyd equ 03 ;pos of key down delay > sdel equ 04 ;pos of start delay > > > org 0x00 > goto start > > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; > ; > ;;;;; 9600 baud ser out routine > ;;;;; > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; > ; > > serout movf txreg, W > movwf mils > > movlw 0x08 > movwf txreg > > bsf porta, serotp ;1 > > movlw 0x17 ;1 > call dlyb ;4+4*23=96 > > tx rrf mils, 1 ;1 lsb -> msb > > btfss status, 0 ;1 > goto st ;2 > goto clr > > st nop ;1 > bsf porta, serotp ;1 > goto nxt ;2 > > clr bcf porta, serotp > goto nxt > > nxt movlw 0x15 ;1 > call dlyb ;4+4*21=88 > > nop ;3 > nop > nop > > decfsz txreg, 1 ;1 unless last. then > 2 > goto tx ;2 skipped on > last > > nop ;1 goto tx > nop ;1 rrf > nop ;1 btfss > nop ;1 goto > nop ;1 goto > > bcf porta, serotp ;1 > movlw 0x18 ;1 > call dlyb ;4+4*24=100 > nop ;1 > > return ;2 > > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > ;;;; 9600 serial recieve routine > ;;;;;;;; > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > > serin movlw 0x08 > movwf mils > > strtbit btfss porta, serinp ;1 > goto strtbit > > movlw 0x10 ;1 > call dlyb ;4+4*16=54 > > nop ;3 > nop > nop > > rxl movlw 0x15 ;1 > call dlyb ;4+4*21=84 > > nop > > btfsc porta, serinp ;1 > goto blow ;2 > goto bhgh > > blow nop ;1 > bcf status, 0 ;1 > goto nxtbt ;2 > > bhgh bsf status, 0 > goto nxtbt > > nxtbt rrf rxreg, 1 ;1 > > decfsz mils,1 ;1 but on last 2 > goto rxl ;2 but on last 0 > > movlw 0x0a ;1 > call dlyb ;4+4*10=44 > > > retlw 00 ;2 > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; > ;;;; delay routine w*4+4 > ;;; > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; > > dlyb movwf mins ;1 > > lp1 nop ;1 > decfsz mins, 1 ;1 > goto lp1 ;2 > > return ;3 > > > > > start movlw b'00000101' > TRIS porta > movlw b'00000000' > tris portb > lopp btfsc porta, 2 > goto lopp > > loop call serin > movf rxreg, W > movwf txreg > call serout > goto loop > > end ________________________________________________________________ YOU'RE PAYING TOO MUCH FOR THE INTERNET! Juno now offers FREE Internet Access! Try it today - there's no risk! For your FREE software, visit: http://dl.www.juno.com/get/tagj.