debug following hi2cin

idema

New Member
Hello,
28x1, axe027
After a read of the ds1307 with the hi2cin command a debug gives the "waiting" window.
But with hi2cin commented out debug gives the display window.
Same with sertxd.
Here is the pertinent code:

Code:
	hi2csetup i2cmaster, %11010000, i2cslow, i2cbyte
	
	; read time and date and debug display	
start:
	hi2cin 0, (b0, b1, b2, b3, b4, b5, b6) ;get clock data			
	pause 2000 ;wait for i/p
	debug	;GIVES DEBUG WAITING
And:
Code:
		hi2csetup i2cmaster, %11010000, i2cslow, i2cbyte
	
	; read time and date and debug display	

	;hi2cin 0, (b0, b1, b2, b3, b4, b5, b6) ;get clock data			
	pause 2000 ;wait for i/p
	debug	;GIVES DEBUG DISPLAY
Is there a way to correct this?
Help will be much appreciated.
Orville
 

oracacle

Senior Member
code works dine in simulation, you maybe missing the read for some reason, try a continuous loop to get more readings, you can most likely get rid of the 2 second pause after the read, or move it to before the read of the time to allow everything time settle

Code:
      [color=Blue]hi2csetup i2cmaster[/color][color=Black], [/color][color=Navy]%11010000[/color][color=Black], [/color][color=Blue]i2cslow[/color][color=Black], [/color][color=Blue]i2cbyte
      
      [/color][color=Green]; read time and date and debug display    [/color]
[color=Black]main:
      [/color][color=Blue]hi2cin [/color][color=Navy]0[/color][color=Black], [/color][color=Blue]([/color][color=Purple]b0[/color][color=Black], [/color][color=Purple]b1[/color][color=Black], [/color][color=Purple]b2[/color][color=Black], [/color][color=Purple]b3[/color][color=Black], [/color][color=Purple]b4[/color][color=Black], [/color][color=Purple]b5[/color][color=Black], [/color][color=Purple]b6[/color][color=Blue]) [/color][color=Green];get clock data            
      [/color][color=Blue]pause [/color][color=Navy]2000 [/color][color=Green];wait for i/p
      [/color][color=Blue]debug [/color][color=Green];GIVES DEBUG DISPLAY
      [/color][color=Blue]goto [/color][color=Black]main[/color]
it may also be halful to havea circuit digram if you still have issues

Edit: iirc there are issue with the debug and i2c

try this too
Code:
      [color=Navy]#terminal 4800
      [/color][color=Blue]pause [/color][color=Navy]1000        [/color][color=Green]'wait for terminal to open
      [/color][color=Blue]hi2csetup i2cmaster[/color][color=Black], [/color][color=Navy]%11010000[/color][color=Black], [/color][color=Blue]i2cslow[/color][color=Black], [/color][color=Blue]i2cbyte
      
      [/color][color=Green]; read time and date and debug display    [/color]
[color=Black]main:
      [/color][color=Blue]hi2cin [/color][color=Navy]0[/color][color=Black], [/color][color=Blue]([/color][color=Purple]b0[/color][color=Black], [/color][color=Purple]b1[/color][color=Black], [/color][color=Purple]b2[/color][color=Black], [/color][color=Purple]b3[/color][color=Black], [/color][color=Purple]b4[/color][color=Black], [/color][color=Purple]b5[/color][color=Black], [/color][color=Purple]b6[/color][color=Blue]) [/color][color=Green];get clock data            
      [/color][color=Blue]pause [/color][color=Navy]2000 [/color][color=Green];wait for i/p
      [/color][color=Blue]sertxd ([/color][color=Black]#[/color][color=Purple]b0[/color][color=Black], [/color][color=Navy]44[/color][color=Black], #[/color][color=Purple]b1[/color][color=Black], [/color][color=Navy]44[/color][color=Black], #[/color][color=Purple]b2[/color][color=Black], [/color][color=Navy]44[/color][color=Black], #[/color][color=Purple]b3[/color][color=Black], [/color][color=Navy]44[/color][color=Black], #[/color][color=Purple]b4[/color][color=Black], [/color][color=Navy]44[/color][color=Black], #[/color][color=Purple]b5[/color][color=Black], [/color][color=Navy]44[/color][color=Black], #[/color][color=Purple]b6[/color][color=Black], [/color][color=Navy]13 [/color][color=Black],[/color][color=Navy]10[/color][color=Blue])
      goto [/color][color=Black]main[/color]
 
Last edited:

Goeytex

Senior Member
I prefer using SERTXD for debugging and use it almost exclusively when debugging my programs . Just place SERTXD lines strategically in the program to display the data that you are interested in.
 

idema

New Member
Thanks oracacle, but no success. Any other possibilities?
Also, issues with debug and i2c? Are they being resolved?
 

Technical

Technical Support
Staff member
There are no known issues with i2c / debug.
If your programming is hanging on the i2c line with both debug and sertxd there is only one conclusion - your i2c hardware is faulty in some way.

What board are you using?
 

idema

New Member
Hello technical,
I'm using the 28-pin project board with a breakout board for the ds1307.
Connection is on pins 14 and 15.
I know I'm successfully reading the ds1307 because checking for the year (14)
to light an led indicates a read.
It will be extremely difficult to test a fairly involved program without displaying variables
in the editor.
 

oracacle

Senior Member
does the project board still have the tie down resistors on port c, if so it needs to be removed and the 4k7 tie ups for i2c installed
 

idema

New Member
Hello everyone,
Without my changing anything in my code both debug and sertxd are displaying
the variables. The only thing I did was slightly agitate the connections on the
boards. Something else to add to my long list of inexplicables.
Many thanks and apologies.
Orville
 
Top