| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| Guest 
 
 
 
 
 
 
 
			
			
			
			
			
			
			
			
			
 
 | 
			
				| Set_UART_Speed() How does this work ? |  
				|  Posted: Sat Jul 31, 2004 6:33 am |   |  
				| 
 |  
				| At what time does the PCH V3.206 compiler set the BAUDCON register ?  I can't find it in the LST file . 
 #include <18F6621.h>
 #use delay(clock=14745600)
 
 ....................         Set_UART_Speed(1200);
 0CBC:  MOVLW  BF
 0CBE:  MOVWF  FAF
 0CC0:  MOVLW  22
 0CC2:  MOVWF  FAC
 ....................         Set_UART_Speed(2400);
 0CC4:  MOVLW  5F
 0CC6:  MOVWF  FAF
 0CC8:  MOVLW  22
 0CCA:  MOVWF  FAC
 ....................         Set_UART_Speed(4800);
 0CCC:  MOVLW  2F
 0CCE:  MOVWF  FAF
 0CD0:  MOVLW  22
 0CD2:  MOVWF  FAC
 ....................         Set_UART_Speed(9600);
 0CD4:  MOVLW  17
 0CD6:  MOVWF  FAF
 0CD8:  MOVLW  22
 0CDA:  MOVWF  FAC
 ....................         Set_UART_Speed(19200);
 |  | 
	
		|  | 
	
		| Ttelmah Guest
 
 
 
 
 
 
 
			
			
			
			
			
			
			
			
			
 
 | 
			
				| Re: Set_UART_Speed() How does this work ? |  
				|  Posted: Sat Jul 31, 2004 6:55 am |   |  
				| 
 |  
				|  	  | Anonymous wrote: |  	  | At what time does the PCH V3.206 compiler set the BAUDCON register ?  I can't find it in the LST file . 
 #include <18F6621.h>
 #use delay(clock=14745600)
 
 ....................         Set_UART_Speed(1200);
 0CBC:  MOVLW  BF
 0CBE:  MOVWF  FAF
 0CC0:  MOVLW  22
 0CC2:  MOVWF  FAC
 ....................         Set_UART_Speed(2400);
 0CC4:  MOVLW  5F
 0CC6:  MOVWF  FAF
 0CC8:  MOVLW  22
 0CCA:  MOVWF  FAC
 ....................         Set_UART_Speed(4800);
 0CCC:  MOVLW  2F
 0CCE:  MOVWF  FAF
 0CD0:  MOVLW  22
 0CD2:  MOVWF  FAC
 ....................         Set_UART_Speed(9600);
 0CD4:  MOVLW  17
 0CD6:  MOVWF  FAF
 0CD8:  MOVLW  22
 0CDA:  MOVWF  FAC
 ....................         Set_UART_Speed(19200);
 | 
 It doesn't.
 The BAUDcon register, is setup as part of the UART initialisation. It is not changed for a different baud rate, so there is no access for the set_uart_speed function.
 
 Best Wishes
 |  | 
	
		|  | 
	
		| Guest 
 
 
 
 
 
 
 
			
			
			
			
			
			
			
			
			
 
 | 
			
				| Re: Set_UART_Speed() How does this work ? |  
				|  Posted: Sat Jul 31, 2004 11:29 am |   |  
				| 
 |  
				|  	  | Ttelmah wrote: |  	  | It doesn't. The BAUDcon register, is setup as part of the UART initialisation. It is not changed for a different baud rate, so there is no access for the set_uart_speed function.
 
 Best Wishes
 | 
 
 That's kind of strange .... the BAUDCON has to be set somewhere....
 BAUDCON1 is at address 0XF7E .
 I can't find that address anywhere in the LST file.
 
 Are you telling me it happens by magic ? :-)
 
 or is there "stuff" that CCS hides ? I thought the LST included everything .
 |  | 
	
		|  | 
	
		| Eric Minbiole 
 
 
 Joined: 10 Jun 2004
 Posts: 16
 Location: USA
 
 
			      
 
 | 
			
				|  |  
				|  Posted: Sat Jul 31, 2004 11:57 am |   |  
				| 
 |  
				|  	  | Quote: |  	  | or is there "stuff" that CCS hides ? I thought the LST included everything . | 
 
 Yes, by default, CCS hides the code for a lot of their 'library' functions.  Take a look at the #list & #nolist directives.  The CCS headers usually turn off listing at the top, and restore it at the bottom.  You could remove the #nolist from the top of 18F6621.h, and you'll probably see the BAUDcon register access.
 |  | 
	
		|  | 
	
		| Guest 
 
 
 
 
 
 
 
			
			
			
			
			
			
			
			
			
 
 | 
			
				|  |  
				|  Posted: Sat Jul 31, 2004 12:14 pm |   |  
				| 
 |  
				|  	  | Eric Minbiole wrote: |  	  |  	  | Quote: |  	  | or is there "stuff" that CCS hides ? I thought the LST included everything . | 
 
 Yes, by default, CCS hides the code for a lot of their 'library' functions.  Take a look at the #list & #nolist directives.  The CCS headers usually turn off listing at the top, and restore it at the bottom.  You could remove the #nolist from the top of 18F6621.h, and you'll probably see the BAUDcon register access.
 | 
 
 Yes I got that... but there are no direct ref. to the BAUDCON1 or 2 reg.
 
 Foo.... The Errata sheet mentions a problem with the UART and it would be great to know what is used and how it's setup.
 |  | 
	
		|  | 
	
		| Ttelmah Guest
 
 
 
 
 
 
 
			
			
			
			
			
			
			
			
			
 
 | 
			
				| Re: Set_UART_Speed() How does this work ? |  
				|  Posted: Sat Jul 31, 2004 2:37 pm |   |  
				| 
 |  
				|  	  | Anonymous wrote: |  	  |  	  | Ttelmah wrote: |  	  | It doesn't. The BAUDcon register, is setup as part of the UART initialisation. It is not changed for a different baud rate, so there is no access for the set_uart_speed function.
 
 Best Wishes
 | 
 
 That's kind of strange .... the BAUDCON has to be set somewhere....
 BAUDCON1 is at address 0XF7E .
 I can't find that address anywhere in the LST file.
 
 Are you telling me it happens by magic ? :-)
 
 or is there "stuff" that CCS hides ? I thought the LST included everything .
 | 
 CCS hides a lot.
 Turning off the 'nolist' directive, makes a lot more visible, but you will still see gaps in the code. The easiest thing, s to import it into a package with a disassembler (MPLAB for instance), and search in this. I have had to do this in the past for a couple of such register updates... :-(
 It does make debugging a real 'pain' at times.
 
 Best Wishes
 |  | 
	
		|  | 
	
		|  |